Hey! So I been having trouble on my rebirth system, bassically when I click the rebirth button it doesn’t work.
I tried a lot of things such as looking into dev console which has no errors, redid the script, even tried to do it on another button, but still doesn’t work.
Script
local plr = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
if plr.leaderstats.Rebirths.Value == 0 and plr.leaderstats.Steps.Value >= 10000 then
workspace.Events.Rebirth:FireServer()
else
if plr.leaderstats.Rebirths.Value >= 1 and plr.leaderstats.Steps.Value >= (plr.leaderstats.Rebirths.Value * 10000) + 10000 then
workspace.Events.Rebirth:FireServer()
end
end
end)
To start you should create a function then connect the click event from a click detector to fire the function, can you show the serverscript of the onserverevent, also I realized you’re not passing any information tot he server for the rebirth for starters do please as the first parameter
If your using a local script, you cant access Workspace with it since it can only see client wise. You’ll need to put the remote events into ReplicatedStorage so both the server and client can see it. And why are you firing an event?
Alright, so I had this similar problem yesterday. It didn’t register the mouse click. Try using .MouseButton1Down instead.
Edit:
Also change :connect() to :Connect()
Edit 2:
Also I realized, since local scripts don’t work in workspace, maybe they don’t see events in there too?
Move the events into ReplicatedStorage and change the variables so it looks at ReplicatedStorage and get the events. That way, it can see the events. LocalScripts cant see anything related to the server, that means it probably wont be able to find anything in workspace.
local player = game.Players.LocalPlayer
local ClickDetector = game.Workspace:WaitForChild("ClickDetectorName")
local event = game.ReplicatedStorage.RemoteEvent -- change whatever the name of the remote event is
local function Rebirth()
if plr.leaderstats.Rebirths.Value == 0 and plr.leaderstats.Steps.Value >= 10000 then
event:FireServer()
end)
ClickDetector.MouseClick:Connect(Rebirth)