Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Sword giver wont run?

I have a loop that will turn the value on and off as well as a few other things but when the value is changed, this script isn't effected. Any Ideas?

if game.workspace.Gamestart.Value == true then
	wait(0.1)
	 local sword = game.ReplicatedStorage.ClassicSword:Clone()
	 sword.Parent = game:GetService("Players").LocalPlayer.Backpack
	 sword.Handle.Mesh.TextureId = script:WaitForChild("TextureId").Value
end

1 answer

Try using the "Changed" event, whenever the value has change (like from false to true and the other way round) It will register and start the code.

function onChanged()
if game.Workspace.Gamestart.Value == true then
--code
elseif game.Workspace.Gamestart.Value == false then
--code
end
end
end
game.Workspace.Gamestart.Value.Changed:connect(onChanged)

This discussion is preserved as it was. New answers, comments, and votes are closed.