ive made this script where you touch a brick and it makes your leaderstats go to 1. i need to put this in a gui but i dont know how this is the script.
local button = script.Parent
function onTouched(hit) if hit ~= nil then local character = hit:FindFirstAncestorOfClass("Model") if character ~= nil then local player = game.Players:GetPlayerFromCharacter(character)
if player ~= nil then
local stats = player:WaitForChild("leaderstats")
local stat = stats:FindFirstChild("Stage")
if stat ~= nil then
stat.Value = 1
--Teleport back to stage 1
end
end
end
end
end
button.Touched:Connect(onTouched)

8 comments
Use the .MouseButton1Click signal for GUIButton Objects; you'll need to use a LocalScript to operate a UI element, as it's a Locally orientated Instance. This is a drawback since the Server is no longer handling the modification of the Leaderstat, therefore the adjustment is ignored due to FE. You'll need to use a RemoteEvent.
so how would the script be?
because ive not really done scripts but ive been looking for a long time for a restart obby gui
This is not a request site, you can find out how to program it by looking up the information mentioned above in the Developer Wiki: .MouseButton1Click, RemoteEvent.
ok
would i have to add something like if mousebutton1click then leaderstats.=1 or something like that cuz ive never done scripting
That is not constructive crybaby cause this will cost you lose rep
Please just put all your code in a codeblock. Stop trying to give this guy a hard time