Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

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

Asked by 2 years ago

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)

0
Mate, it is wait(2), not wait(2. AProgrammR 398 — 2y
0
his script doesn't work even if yayaheyman 90 — 2y
0
it's not gonna fire correctly because it's client sided yayaheyman 90 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

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!

Ad

Answer this question