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

TextButton.Rebirth:15: Expected ')' (to close '(' at line 14), got 'script' ?

local player = game.Players.LocalPlayer local clicks = player:WaitForChild("leaderstats"):WaitForChild("Clicks") local rebirths = player:WaitForChild("leaderstats"):WaitForChild("Rebirths")

script.Parent.MouseButton1Click:Connect(function() if clicks.Value >= 100 then script.Parent.Text = "Success!" rebirths.Value = rebirths.Value +5 clicks.Value = 0

end 
if clicks.Value < 100 then
	script.Parent.Text = "Not Enough Clicks"
	wait(2
		script.Parent.Text = "5 Rebirths - 100 Clicks"
 end

end)

3 comments

0

Mate, it is wait(2), not wait(2.

0

his script doesn't work even if

0

it's not gonna fire correctly because it's client sided

1 answer

✓ Accepted answer

There are multiple things wrong, First of all you shouldn't make this a script or a local one, What you should do is the following:

Make a Remote Event to rebirth the player, Give the Remote Event a OnServerEvent function:

(note: If you want to just copy this straight up make sure to name the remote event "RebirthEvent" and put it inside the text button with the script and the local script that fires it)

script.Parent.RebirthEvent.OnServerEvent:Connect(function() 
	local player = script.Parent.Parent.Parent.Parent
	local rebirths = player:WaitForChild("leaderstats"):WaitForChild("Rebirths")
	local clicks = player:WaitForChild("leaderstats"):WaitForChild("Clicks")
	
	if clicks.Value >= 100 then 
		script.Parent.Text = "Success!" 
		rebirths.Value = rebirths.Value + 5 
		clicks.Value = 0

end
		if clicks.Value < 100 then
			    script.Parent.Text = "Not Enough Clicks"
          wait(2)
		script.Parent.Text = "5 Rebirths - 100 Clicks"	 end
end)

Local script to fire the RemoteEvent:

script.Parent.MouseButton1Click:Connect(function()
	script.Parent.RebirthEvent:FireServer()
end)

If this helped make sure to mark this answer as solution!

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