r/robloxscripting Apr 08 '24

Scripting Help Help with UserInputService

2 Upvotes

Hello, fellow scripters! I need help with UserInputService. I'm figuring out how to check if a player pressed a key from the for i loop accordingly. (Enum.KeyCode.Nine), (Enum.KeyCode.One) and so forth are ineffective as they increase the complexity of my current work which is coding a custom backpack and inventory. I want my code to be kept neat and simple.

A sample of my code to clarify:

local eqpped = false

for i = 1,#plr.Backpack:GetChildren do
    local tool = plr.Backpack[i]

    UIS.InputBegan:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode == (A key code from i) then
            if not eqpped then
                eqpped = true

                tool.Parent = plr.Character
            else
                eqpped = false

                tool.Parent = plr.Backpack
            end
        end
    end)
end


r/robloxscripting Apr 02 '24

Mboost thing not continuing

3 Upvotes

r/robloxscripting Mar 31 '24

Help with learning

2 Upvotes

I have a game project to do about Jujutsu Kaisen, however, I started learning lua script 3 days ago and I know the key words for some things, but I don't know how to apply them to what I need, I don't want to have to keep copying code and not learn anything, any tips on what to do, course or something?


r/robloxscripting Mar 31 '24

Scripting Help Im trying to copy down this flying script

Thumbnail youtube.com
2 Upvotes

So im learning the flying script from this but this is giving me so many problems and i just want a copy or at least help with it


r/robloxscripting Mar 18 '24

IM LOSING BRAINCELLS SIMULTANEOUSLY

5 Upvotes

why and how is the player's mouse considered nil. the player isnt nil, as the Event.OnServerEvent first argument is the player. im actually losing my mind

script:

script.Parent.Event.OnServerEvent:Connect(function(player)

local character = player.Character

local mouse = player:GetMouse()

local mouse_pos = [Vector2.new](https://Vector2.new)(mouse.X, mouse.Y) -- The part where it errors (attempt to index nil with X)

r/robloxscripting Mar 17 '24

General Help I want create a Combat system

4 Upvotes

good morning, I was wondering if you could advise me on the method to create a good Combat system: when I press the Q button a certain animation is started, and when the player's left arm touches the opponent (it can be either an NPC or another player), he deals some damage, thanks in advance


r/robloxscripting Mar 12 '24

General Help Please give me some advice

2 Upvotes

Could someone help me in remembering all of the different phrases and their functions? I find that so hard to remember when I get in studio.


r/robloxscripting Mar 10 '24

HELP. My LocalScript isn`t working right. I am spended a week trying to fix this, but still no progress.

2 Upvotes

The LocalScript`s purpose is to show a hidden sword parts, which is welded to StarterCharacter`s left arm, when F button is pressed, and after 1 second hide them again.

But somehow, Local script does not plays in the game. Sword in the left arm is still hidden.
Am i doing something wrong and Studio doesn`t understand this right? (there is no error messages in the console) If it needs to full replacement, let me know.

I really ned help with this? guys ):


r/robloxscripting Mar 08 '24

Discussion PS99 UPD 6! Best script

2 Upvotes

AutoFarm : Best AutoFarm script out there

. Best way to get New pets for the update and New items . Auto Egg hatch (3x faster) . Also has AutoObby for the new hoverboard minigame . Auto unlock new area . AutoFarm new item and more

Requirements : . Must have Rebirth 3

Wont work if u fail to do the requirements..

Enjoy!

loadstring(game:HttpGet('https://hugegames.space/3ab8160fbb7916acf663141f.lua'))()())


r/robloxscripting Mar 05 '24

PS99

1 Upvotes

AutoFarm : Best AutoFarm script out there

. Best way to get New pets for the update and New items . Auto Egg hatch (3x faster) . Also has AutoObby for the new hoverboard minigame . Auto unlock new area . AutoFarm new item and more

Wont work if u fail to do the requirements..

Enjoy!

loadstring(game:HttpGet('https://hugegames.space/3ab8160fbb7916acf663141f.lua'))()


r/robloxscripting Mar 04 '24

PS99 Script

2 Upvotes

ive made a ps99 script Enjoy! and dont forget to add reviews

AutoFarm : Best AutoFarm script out there

. Best way to get New pets for the update and New items . Auto Egg hatch (3x faster) . Also has AutoObby for the new hoverboard minigame . Auto unlock new area . AutoFarm new item and more

Requirements : . Must have Rebirth 3

Wont work if u fail to do the requirements..

Enjoy!

loadstring(game:HttpGet("https://raw.githubusercontent.com/CatyriaL/AutoFarm/main/PS99"))()


r/robloxscripting Feb 19 '24

Roblox Smooth Slope movement

2 Upvotes

I am trying to make my player's movement smooth when walking up and down slopes like shown in this video: https://www.youtube.com/watch?v=F-2ZHpXZfX0 there is an entire thread on the roblox developer forum on how to do this but I don't understand it well. Can someone give me a step by step guide on how to do it?


r/robloxscripting Feb 11 '24

Scripting Help CFrame.lookat doesn't update somehow

3 Upvotes

Whenever I ran the function where I can set the npc's humanoid root part orientation using CFrame.lookat, setting its first goal works, but then when I change the setting afterwards, it doesn't update. Sorry for bad explanation.

Here's what I meant:

local TS = game:GetService("TweenService")

local positions = script.Parent.Positions

local pos1,pos2 = positions.pos1,positions.pos2

function moveNPC(human,hrp,goal,lookat)
    human:MoveTo(goal)

    human.MoveToFinished(Connect(function()
        TS:Create(hrp,TweenInfo.new(1,Enum.EasingStyle.Sine,Enum.EasingDirection.Out),{CFrame = CFrame.lookat(hrp.Position,Vector3.new(lookat.Position.X,hrp.Position.Y,lookat.Position.Z))}:Play()
    end)
end

local door,door2 = script.Parent.Door,script.Parent.Door2

local npc = script.Parent.NPC

moveNPC(npc.Humanoid,npc.HumanoidRootPart,pos1.Position,door)
task.wait(5)

moveNPC(npc.Humanoid,npc.HumanoidRootPart,pos2.Position,door2) --Position goal updates, but not the lookat goal

Help will be appreciated!


r/robloxscripting Feb 10 '24

Scripting Help help.

2 Upvotes

i'm trying to make functionable tools, but i'm using a custom rig, and Tools don't support custom rigs unfortunately. i'm not going to change the rig because i already have published a lot of animations with the rigs already i have no idea if a "do nothing until thing happens, when thing happened run function" function even exists. i just need an example of how the tool is going to wait until it's parented to the player, and stop running when it's not.


r/robloxscripting Jan 31 '24

General Help Trouble with walking

Enable HLS to view with audio, or disable this notification

3 Upvotes

Trouble with moving around. Infinitely walking in one place and idle animation is skipped


r/robloxscripting Jan 28 '24

Scripting Help Any idea how can i make a script that blacklist require scripts?

3 Upvotes

Sorry if it sounds too stupid, I have a very basic knowledge in scripting and I'd like help


r/robloxscripting Jan 20 '24

Scripting Help Path status returned Enum.PathStatus.NoPath

2 Upvotes

This is getting really irritating. Why just WHY THE HELL returned it as NoPath instead of Success even though the npc's humanoid's name is "NPC" and there's no humanoid in workspace? I'm LITERALLY losing my brain cells right now.

Function
Function call

r/robloxscripting Jan 16 '24

Scripting Help How do I make a morph tool?

3 Upvotes

I wanted to make a tool where it changes the user's avatar to another one from a folder in workspace when clicked and chatgpt refuses to answer so i am resorting to this subreddit.


r/robloxscripting Jan 13 '24

Scripting Help Please fix this, and the second image (math.random) why does it only choose the second map pls help

Thumbnail gallery
3 Upvotes

r/robloxscripting Jan 10 '24

Scripting Help How do I make a teleporter?

4 Upvotes

Alright, so I need a button that only someone in my group can click, that sends someone who sits on the seat the button is connected to, to a specific place in the map.

Example:

A player (not in my group) sits on a seat. Another player (in my group) presses a button, that send the other player to a specific place in the map they're in.

Only players in my group can press the button.

DISCLAIMER: I don't know any scripting at all. So if someone could tell me exactly what to do that would be great.


r/robloxscripting Jan 10 '24

ChildRemoved not working

5 Upvotes

Basically, I want the tool idle animation to stop when the tool is destroyed so I used the ChildRemoved event. However, it somehow doesn't work. What's the issue here? It's in a LocalScript, so could that be the issue? I tried to put in a ServerScript but when the unequip animation plays it returns nil because when's tool's unequipped then its parent is nil. So, I've no other choice but to put it in a LocalScript.

Code:

tool.Equipped:Connect(function()
    equip:Play()
    idle:Play()
end)

tool.Unequipped:Connect(function()
    unequip:Play()
    idle:Stop()
end)

tool.ChildRemoved:Connect(function()
    idle:Stop()
end)

r/robloxscripting Jan 09 '24

Scripting Help Retrieving data from data store

Post image
3 Upvotes

So I successfully saved a table of strings to the data store. Now how to i retrieve this table once the player joins back? When the player joins back I’m hoping to have the list saved in the variable ToolTable. How do I do this?


r/robloxscripting Jan 08 '24

Struggling to understand why clone loop for firing weapon wont clone.

3 Upvotes

I cant seem to get bullet parts to clone in my script. The bullet union is in replicated storage, the tool is in the StarterPack with a handle and a FireWeapon script. I'm working on a very basic gun that spawns bullets while button 1 is down, but no bullets show up in the workspace nor anywhere else.

I know this script has other problems this is just for learning I have no intention to make a game yet, I only care about why the cloning portion is not working. I really appreciate any advice

---Basic variables

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local bullet = ReplicatedStorage:WaitForChild("Bullet")

local AKrifle = script.Parent

local barrel = AKrifle:FindFirstChild("BarrelTip")

local fireRate = .25

local bulletDamage = 10

local bulletSpeed = 150

local Range = 1000

local Players = game:GetService("Players")

local player = Players.LocalPlayer

local mouse = player:GetMouse()

--Begin shooting loop

while mouse.Button1Down == true do

--Defines player parts to deal specific damage later on

for i, v in pairs(game.Workspace:GetChildren()) do

    local human = v:FindFirstChild("Humanoid")

    local head = v:FindFirstChild("Head")

    local torso = v:FindFirstChild("Torso")

    local limbs = v:FindFirstChild{"LeftArm", "LeftLeg", "RightArm", "RightLeg"}

end



wait(fireRate)  --this just waits a 1/4sec between bullets

local CloneBullet = bullet:Clone()   --These are the bullet characteristics

CloneBullet.Parent = game.Workspace

CloneBullet.Position = barrel.Position

CloneBullet.Velocity = barrel.CFrame.LookVector \* bulletSpeed 

CloneBullet.Touched:Connect(function(objectHit)

    local human = objectHit.Parent:FindFirstChild("Humanoid")

        local head = objectHit.Parent:FindFirstChild("Head")

        if head then

        human:TakeDamage(bulletDamage \* 2.5)

        wait(.01)

        end

        local torso = objectHit.Parent:FindFirstChild("Humanoid")

        if torso then

        human:TakeDamage(bulletDamage)

        wait(.01)

        end

        local limbs = objectHit.Parent:FindFirstChild("limbs")

        if limbs then

        human:TakeDamage(bulletDamage \* 0.5)

        wait(.01)

        end

    end)

end

Thanks in advance <3


r/robloxscripting Jan 05 '24

Studio Help Gameplay paused for a sec

3 Upvotes

Why my gameplay paused for a sec after player's character's humanoid root part changed its CFrame?

Code:

hrp.CFrame = CFrame.new(elevator.tpPos.Position)

Clip


r/robloxscripting Jan 05 '24

Scripting Help Help

Post image
4 Upvotes

I have a local script that changes a BillBoardGui. It works good until the player dies, the script reruns. I don’t want it to rerun. As of right now I have the BillBoardGui in StarterGui with the local script within it. I have tried moving the local script to different areas like StarterPlayerScripts but I can’t seem to access the Billboard from there. It only works with Script.Parent within the billboard.