Steakwiz
(Steakwiz)
April 27, 2025, 8:48pm
#1
Hello everybody. Does everybody know whats happening? How to fix this?
In outpit i can see “Server is ok”
But no “Client is”
and also cancollide isnt change local and server
server script
script.Parent.MouseClick:Connect(function(plr)
print("Server is ok")
script.Parent.RemoteEvent:FireClient(plr)
end)
Local script
script.Parent.RemoteEvent.OnClientEvent:Connect(function()
print("Client is")
script.Parent.Parent.CanCollide=not script.Parent.Parent.CanCollide
end)
Typically, you should not be checking for mouse clicks on the server side, it is not reliable and you can run into problems like this.
What you should do instead is check for mouse clicks on the client side, and then change the can collide of your part during a mouse click.
Steakwiz
(Steakwiz)
April 27, 2025, 8:55pm
#3
i tried. didnt work at alll.
Even like that so
can you show your explorer to be clearer
thats the issue cant have localscripts in the workspace
I am not sure what you mean, here’s what you can do:
-- On the client side
script.Parent.MouseClick:Connect(function()
local currentState = script.Parent.Parent.CanCollide
if currentState == true then
script.Parent.Parent.CanCollide = false
return
end
script.Parent.Parent.CanCollide = true
end)
Steakwiz
(Steakwiz)
April 27, 2025, 8:58pm
#8
what do you mean? I didnt really understand soo…
ys3741
(ys3741)
April 27, 2025, 8:59pm
#9
The local script should be inside of StarterPlayerScripts
Steakwiz
(Steakwiz)
April 27, 2025, 8:59pm
#10
didnt work . As i told you. It is not working. I tried.
You cannot have local scripts in the workspace as they do not run. For your case, do not fire any events and just change the can collide property when the button is clicked.
move the local script to startercharacterscripts or starterplayerscript and move the remote event to replicated storage
Steakwiz
(Steakwiz)
April 27, 2025, 9:00pm
#13
thats strange i guess. Lol, why does it work like that? Anyways thanks
no problem did you change your code for it