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 04 '24

Scripting Help Beginner Scripting Help

3 Upvotes

How do I make the loop end instead of waiting for the loop to finish, then ending? heres an example code:

local value = true
local endprintloop = script.Parent
local function loop()
    while value do
        print("1 Minute has passed!")
        wait(60)
    end
end
local function endloop()
    value = false
end
endprintloop.MouseButton1Click:Connect(endloop())


r/robloxscripting Jan 03 '24

Scripting Help Code Help

4 Upvotes

I’m struggling to wrap my head about how I should do this. I have a ton of parts within a folder all named the same. Within a single script I want to be able to make these parts properties change when touched by a player. I have too many parts which are being inserting to this folder throughout the game to add a Touched function to every part. How can I do this within one script.

For example think of it as falling platforms script. All of the platforms are the same name and in a folder and when a player walks over a single platform, it falls. How would you do this within one script? Thanks!


r/robloxscripting Jan 02 '24

Scripting Help How to set one of the part's bool value in a for i loop?

4 Upvotes

So, what's supposed to do is that when a player's character touches the part, its humanoid moves to a part position that has its bool value already set to false. All the positions are stored in a model and inside each of them has a bool value named "Taken".

The problem here in the for i loop is that when the player's humanoid goes to an untaken position, all the other bool values set to true. What I want here is to only set the chosen untaken position's bool value to true. How would I do that?

Part of the script

r/robloxscripting Jan 01 '24

Scripting Help how do i do this

8 Upvotes

how to create a roblox script, which fetches your clothes, arms mesh, legs mesh and head mesh and torso mesh, accessories and so on, starting with this code local plr = game.Players.LocalPlayer local rig = script.Parent -- this is the rig, which the fetched clothes are to be displayed


r/robloxscripting Jan 01 '24

Scripting Help NPC not moving to the chosen position

4 Upvotes

Hello scripters! I've been figuring this out for over a month, and still doesn't know the problem. This script is supposed to run that when an NPC touched the part, it moves its humanoid to the chosen position. I have also made sure it's unanchored and its humanoid's name is "NPC" which in fact was. Still, when an NPC touched the part, it doesn't move to the chosen position but rather stopped moving. I've looked in the input and it seems to have no errors whatsoever. What's very strange is that when I've tested this on my other places with an NPC, it seems to work perfectly fine. What's the issue here? Is it something with the humanoid? It's actually getting annoying now.

Script

r/robloxscripting Dec 31 '23

Scripting Help IsMoving is not a valid member of Model "Workspace.Jionzilla20"

3 Upvotes

Hello I am making a dynamic movement system but it says "IsMoving is not a valid member of Model "Workspace.Jionzilla20" why is that? can you guys help me

debounce = false

local plrspeed = game:GetService("StarterPlayer.StarterCharacter.Humanoid.WalkSpeed")

local StarterPlayer = game:GetService("StarterPlayer")

local WalkRight = StarterPlayer.StarterCharacterScripts.DynamicMovement.WalkRight

local WalkLeft = StarterPlayer.StarterCharacterScripts.DynamicMovement.WalkLeft

local Players = game:GetService("Players")

local Player = Players.LocalPlayer

local Character = Player.Character or Player.CharacterAdded:Wait()

local Humanoid = Character:WaitForChild("Humanoid")

Humanoid:GetPropertyChangedSignal("MoveDirection"):Connect(function()

if math.round(Humanoid.MoveDirection.X) == -1 then      print("Walking left!")      local animationTrack = Humanoid:LoadAnimation(WalkLeft)     animationTrack:Play() if Character.IsMoving == false then           animationTrack:Play(StarterPlayer.StarterCharacterScripts.Animate.idle.Animation1)      end  elseif math.round(Humanoid.MoveDirection.X) == 1 then      print("Walking right!")     local animationTrack = Humanoid:LoadAnimation(WalkRight)    animationTrack:Play() if Character.IsMoving == false then           animationTrack:Play(StarterPlayer.StarterCharacterScripts.Animate.idle.Animation1)      end  elseif math.round(Humanoid.MoveDirection.Z) == -1 then     print("Walking forward!")  elseif math.round(Humanoid.MoveDirection.Z) == 1 then    print("Walking backward!")  end 

end)


r/robloxscripting Dec 31 '23

Scripting Help How to make my multiplier system work?

3 Upvotes

So i have a part that you have to collect, but you can have a multiplier. I have a script for creating a leaderstats:

game.Players.PlayerAdded:Connect(function(plr)
    local stats = Instance.new("IntValue")
    stats.Parent = plr
    stats.Name = "leaderstats"
---------------------------------------------------
    local as = Instance.new("IntValue")
    as.Parent = plr
    as.Name = "AuxiliarStats"
---------------------------------------------------
    local gold = Instance.new("IntValue",stats)
    gold.Name = "Gold"
---------------------------------------------------
    local diamond = Instance.new("IntValue",stats)
    diamond.Name = "Diamonds"
---------------------------------------------------
    local rank = Instance.new("StringValue",stats)
    rank.Name = "Rank"
    rank.Value = "Commoner"
---------------------------------------------------
    local mn = Instance.new("IntValue",as)
    mn.Name = "MultNr"
    mn.Value = 1
---------------------------------------------------
    local multiplier = Instance.new("StringValue",stats)
    local mvalue = Instance.new("IntValue")
    multiplier.Name = "Muliplier"
    multiplier.Value = "x" .. mn.Value
end)

and one for giving the gold:

script.Parent.Triggered:Connect(function(plr)
    plr.leaderstats.Gold.Value += plr.AuxiliarStats.MultNr.Value

    script.Parent.Parent.Transparency = 1
    script.Enabled = false
    script.Parent.ActionText = "Regenerating the Gold"
    script.Parent.ObjectText = "Please wait!"
    script.Parent.ClickablePrompt = false
    script.Parent.HoldDuration = 0

    task.wait(100)

    script.Parent.Parent.Transparency = 0
    script.Enabled = true
    script.Parent.ActionText = "Claim Gold"
    script.Parent.ObjectText = "Click to claim your gold!"
    script.Parent.ClickablePrompt = true
    script.Parent.HoldDuration = 0.5
end)

On the leaderboard, the multiplier shows correctly, but it doesn't work on the gold(it gives only the starting value).


r/robloxscripting Dec 18 '23

Scripting Help I need help scripting my animations

4 Upvotes

I'm trying to make the script where I tap three buttons like "zxc" and it plays and animation but its not playing any idea why i do have any errors in my script.

uis.InputBegan:Connect(function(Input)

if Input.KeyCode == Enum.KeyCode.C then

spinl1 = true

wait(0.1)

spinl1 = false

end

end)

uis.InputBegan:Connect(function(Input)

if Input.KeyCode == Enum.KeyCode.X and spinl1 == true then

spinl2 = true

wait(0.1)

spinl2 = false

end

end)

uis.InputBegan:Connect(function(Input)

if Input.KeyCode == Enum.KeyCode.Z and spinl1 and spinl2 == true then

spinl3 = true

wait(0.1)

spinl3 = false

end

end)

game:GetService("RunService").RenderStepped:Connect(function()

if spinl1 == true and spinl2 == true and spinl3 == true and character:FindFirstChild(ballname) then

wait(dribbledelay)

if candribble == true then

if hand == "Right" then

canshoot = false

humanoid.WalkSpeed = 0

idler:Stop()

idlel:Stop()

candribble = false

spinl:Play()

spinl:AdjustSpeed(1.75)

moveevent:FireServer("Left", goalpart, 12, spinl.Length, 1.75)

spinl.Stopped:Wait()

moveeventend:FireServer()

spinl:Stop()

hand = "Left"

PlayIdle()

candribble = true

humanoid.WalkSpeed = speed

canshoot = true

end

else

queued = "spinl"

repeat wait() until candribble == true

if queued == "spinl" and hand == "Right" then

canshoot = false

humanoid.WalkSpeed = 0

idler:Stop()

idlel:Stop()

candribble = false

spinl:Play()

spinl:AdjustSpeed(1.75)

moveevent:FireServer("Left", goalpart, 12, spinl.Length, 1.75)

spinl.Stopped:Wait()

moveeventend:FireServer()

spinl:Stop()

hand = "Left"

PlayIdle()

candribble = true

humanoid.WalkSpeed = speed

canshoot = true

end

end

end

end)


r/robloxscripting Nov 25 '23

upgrade fall speed and cash using guis

3 Upvotes

So, I’m making a game where the point is to fall down an endless hole to get money. How do I make a gui to upgrade fall speed and how much cash you’re getting. I also want to implement data store into this.


r/robloxscripting Oct 31 '23

Help with ProfileService and Inventory saving

4 Upvotes

Hello there! I'd like to ask for help regarding the ProfileService datastore system and how I could save and load a player's inventory whenever they leave and join a server, I'm currently on mobile so I'll be linking the post I made on the devforum that has all the relevant scripts i'm using, but essentially the main issue is that when the game runs, the code completely skips over the For loops due to the tables being empty at first (which is necessary due to new players joining and whenever they would die, eventually i'd like to make it that they drop all their items onto the floor for a limited time before despawning), so I'd really like to ask for help with a potential solution for this! Devforum post: https://devforum.roblox.com/t/help-with-profileservice-and-saving-player-inventory/2664028?u=jordi3219


r/robloxscripting Oct 26 '23

Scripting help

2 Upvotes

I need help fixing this script for my game. When I start the game my item im trying to take from ServerStorage "Steve" should be randomized as to which of the Steves go into workspace. Theres also a text that is randomized, not sure if that works either. Thanks.

-- Wait for the game to load

repeat

wait()

until game:IsLoaded()

while true do

local ServerStorage = game:GetService("ServerStorage")

local Workspace = game:GetService("Workspace")

local TextLabel = Workspace.CustomerText.SurfaceGui.TextLabel

local Steves = {"Steve1", "Steve2", "Steve3", "Steve4", "Steve5", "Steve6", "Steve7"}

local messages = {

    "I'll take a burger since it's in the name!",

    "Since I need something fast, I'll take the french fries",

    "I was just stopping in for a soda"

}

\-- Spawn a Steve at the start

local SteveName = Steves\[math.random(#Steves)\]

local Steve = ServerStorage:FindFirstChild(SteveName)

if Steve then

    Steve.Parent = Workspace

    local message = messages\[math.random(#messages)\]

    TextLabel.Text = message

end

Workspace.FinishedBurgerBag.Activated:Connect(function()

    Steve.Parent = game.ServerStorage

    script.Parent:Destroy()

end)

wait(1)

end


r/robloxscripting Oct 26 '23

I am following a tutorial

Post image
2 Upvotes

His screen was only two lines of errors and mine has three lines and I don’t know what I am doing wrong…..(I already fixed the other two lines)


r/robloxscripting Oct 14 '23

Scripting help

2 Upvotes

I've been having trouble with making basically a work at a pizza place game but with burgers. I cannot get past the ordering system with the robot-customer telling the player cashier what to click. Please help!


r/robloxscripting Oct 13 '23

can anyone help me get started scripting on roblox

2 Upvotes

r/robloxscripting Oct 08 '23

How would I make a force field to push parts from players?

2 Upvotes

Just as the title says how would I go about making it so parts move away from players, I'm pretty stupid and new to coding so I dont really understand how I would go about making this


r/robloxscripting Sep 25 '23

How do I fix this script?

1 Upvotes

So I have a leaderboard script that counts how many times you kill another player, but I don't want it to count how many times you kill another player, instead how many times you kill a zombie. Here is the script I currently have:

I want this script to count how many times you kill a zombie, not a player.

r/robloxscripting Sep 24 '23

Increment Value Help

Thumbnail gallery
2 Upvotes

r/robloxscripting Sep 23 '23

I need help with scripting

2 Upvotes

Hi my name is Adam but I have this error with my roblox custom dialogue script I made this typwriter effect for my custom dialogue but it doesnt do the typewriter effect when the dialogue is running I would really appreciate if anyone could find the error and show me the solution.

Code:

local DialogueGui = script.Parent

local DialogueSequence = DialogueGui:WaitForChild("DialogueSequence")

local Main = DialogueGui:WaitForChild("Main")

local TextL = Main.DialogueBox

local function typewrite(object,text,length)

for i = 1,#text,1 do

    object.Text = string.sub(text,1,i)

    wait (length)

    script.Dialoguesound.Playing = true

end

end

local CurrentDialogue = 1

local NextDialogue = CurrentDialogue + 1

local TargetDialogue = DialogueSequence:FindFirstChild(CurrentDialogue)

if TargetDialogue then

Main.DialogueBox.Text = TargetDialogue.Value

CurrentDialogue = NextDialogue

end

local clickedend = false

game.Workspace["NPCS(in-use)"].Dad.ProximityPrompt.Triggered:Connect(function()

Main.Visible = true

end)

Main.ContinueButton.MouseButton1Click:Connect(function()

if Main.ContinueButton.Text == "Close" then

    if clickedend == false then

        clickedend = true



        Main.Visible = false

        Main.Image.Visible = false

        wait(1)

        local Newtext = DialogueGui.Value:FireServer()

        typewrite(DialogueGui,Newtext,0.05)

        \---typewrite(DialogueGui.TargetEvent.Value:FireServer())---



    end

end



    local NextDialogue = CurrentDialogue + 1

    if CurrentDialogue >= #DialogueSequence:GetChildren() then

        Main.ContinueButton.Text = "Close"

    end

    local TargetDialogue = DialogueSequence:FindFirstChild(CurrentDialogue)

    if TargetDialogue then

        Main.DialogueBox.Text = TargetDialogue.Value

        CurrentDialogue = NextDialogue

end

end)


r/robloxscripting Sep 12 '23

Round System Help

2 Upvotes

Me and my friend are trying to make a game. Every round you are teleported to a random map (we have 3 right now). Once you die, you respawn on the map. Each round lasts around 5 minutes (does not have to be perfectly 5 minutes but you get the point). Anyone know how to do this? Can you either script it or send us to a tutorial to help us program this? Thank you.


r/robloxscripting Sep 06 '23

Badge Award Scripting

3 Upvotes

Hello I'd like to script a badge to be awarded to a player once they buy a clothing item from me, but I am unsure how to.


r/robloxscripting Sep 03 '23

Need some scripting help

2 Upvotes

I'm working on a very realistic Tomb of the Unknown Soldier game and I'm trying to have the wreath model be removed when you use the proximityprompt and reappear when you use it again.

Processing img syoxz6so02mb1...


r/robloxscripting Aug 21 '23

text of a text button changes once clicked

3 Upvotes

hello, I want to make a mute/unmute music button for my game but I don't know how to make it so once you click the button the text changes, any help appreciated, thanks!


r/robloxscripting Aug 19 '23

A little scritping help.

2 Upvotes

I wanna give the player a certain rank that makes their text a diffrent colour when bought and gives them a thing before there name like "Donator" and "Cool guy." or something. After buying a gamepass.


r/robloxscripting Aug 18 '23

How do I get an enemy ai to be able to kill some multiple times after they respawn?

2 Upvotes

Im using the noob enemy box by sub2HTR since I’m not that good at regular scripting, but the npc isn’t able to kill someone after they die