The first parameter of OnServerEvent
will automatically pass the player, afterwards tuple arguments so it’s not necessary to do that, otherwise you’ll just be messing your order of arguments
I told him to do it on the client not Server
still didnt work, any other suggestions on what i should try? Or should I redo the script. [ make new gui and stuff aswell]
the script is parented to the button
local plr = game.Players.LocalPlayer
local RS = game:GetService("ReplicatedStorage")
print("Script running")
local function Rebirth()
print("Button pressed")
if plr.leaderstats.Rebirths.Value == 0 and plr.leaderstats.Steps.Value >= 10000 then
print("Rebirthing for the first time")
RS.Events.Rebirth:FireServer()
elseif plr.leaderstats.Rebirths.Value >= 1 and plr.leaderstats.Steps.Value >= (plr.leaderstats.Rebirths.Value * 10000) + 10000 then
print("Not your first time? Rebirth again!")
RS.Events.Rebirth:FireServer()
end
end
script.Parent.MouseButton1Click:Connect(Rebirth)
Could you try this and see what outputs?
That outputted, “Script running” but nothing else when i clicked it
Ok you’re either using the wrong event, or your object isn’t correct
What object is the button that you mentioned earlier? Just a regular TextButton
?
Its a TextButton, nothing else then that
I changed the script to this :
local RS = game:GetService("ReplicatedStorage")
print("Script running")
script.Parent.MouseButton1Click(function()
print("Button pressed")
if plr.leaderstats.Rebirths.Value == 0 and plr.leaderstats.Steps.Value >= 10000 then
print("Rebirthing for the first time")
RS.Events.Rebirth:FireServer()
elseif plr.leaderstats.Rebirths.Value >= 1 and plr.leaderstats.Steps.Value >= (plr.leaderstats.Rebirths.Value * 10000) + 10000 then
print("Not your first time? Rebirth again!")
RS.Events.Rebirth:FireServer()
end
end) ```
Output
20:27:40.086 Script running - Client - RebirthSend:4
20:27:40.086 Players.cooldestroyer272alt2.PlayerGui.RebirthMenu.RebirthsMenu.Button.RebirthSend:6: attempt to call a RBXScriptSignal value - Client - RebirthSend:6
20:27:40.087 Stack Begin - Studio
20:27:40.087 Script ‘Players.cooldestroyer272alt2.PlayerGui.RebirthMenu.RebirthsMenu.Button.RebirthSend’, Line 6 - Studio - RebirthSend:6
20:27:40.087 Stack End - Studio
20:27:53.277 AddStep is not a valid member of Script “Workspace.Events” - Client - LocalScript:4
20:27:53.277 Stack Begin - Studio
20:27:53.278 Script ‘Players.cooldestroyer272alt2.PlayerGui.LocalScript’, Line 4 - Studio - LocalScript:4
20:27:53.278 Stack End - Studio
20:27:56.400 Script running - Client - RebirthSend:4
20:27:56.400 Players.cooldestroyer272alt2.PlayerGui.RebirthMenu.RebirthsMenu.Button.RebirthSend:6: attempt to call a RBXScriptSignal value - Client - RebirthSend:6
20:27:56.400 Stack Begin - Studio
20:27:56.400 Script ‘Players.cooldestroyer272alt2.PlayerGui.RebirthMenu.RebirthsMenu.Button.RebirthSend’, Line 6 - Studio - RebirthSend:6
20:27:56.400 Stack End - Studio
You didn’t connect the event
local RS = game:GetService("ReplicatedStorage")
print("Script running")
script.Parent.MouseButton1Click:Connect(function()
print("Button pressed")
if plr.leaderstats.Rebirths.Value == 0 and plr.leaderstats.Steps.Value >= 10000 then
print("Rebirthing for the first time")
RS.Events.Rebirth:FireServer()
elseif plr.leaderstats.Rebirths.Value >= 1 and plr.leaderstats.Steps.Value >= (plr.leaderstats.Rebirths.Value * 10000) + 10000 then
print("Not your first time? Rebirth again!")
RS.Events.Rebirth:FireServer()
end
end)
Oh, and btw still doesnt work so i’ll try to make a new rebirthing system, so its fine.
I’m seeing lots of plr
’s but what I’m not seeing is where it is defined.
He probably just forgot to put the plr
variable inside, he already defined it when the Output started
local plr = game.Players.LocalPlayer
local leaderstats = plr:WaitForChild("leaderstats")
local RS = game:GetService("ReplicatedStorage")
print("Script running")
script.Parent.MouseButton1Click:Connect(function()
print("Button pressed")
if leaderstats.Rebirth.Value == 0 and leaderstats.Steps.Value >= 10000 then
print("Rebirthing for the first time")
RS.Events.Rebirth:FireServer()
elseif leaderstats.Rebirths.Value >= 1 and leaderstats.Steps.Value >= (plr.leaderstats.Rebirths.Value * 10000) + 10000 then
print("Not your first time? Rebirth again!")
RS.Events.Rebirth:FireServer()
end
end)
i had
local plr = game.Players.LocalPlayer
in the script (ontop) and on the script you mentioned there was local plr.
Local Script or Server Script?
that was a local script, not a server
Try this varible
local Players = game:GetService(“Players”)
local plr = Players.LocalPlayer
But do we know what print statement it is getting to?
I did, still won’t work, its fine im making a new system for rebirthing