✓ Accepted answer
Why use RemoteEvents?
The RemoteEvent make a connection with the clients and the server.
Why use RemoteEvent? Recently ROBLOX make a update to against the hackers. In this update ROBLOX have insert the "FilteringEnabled". This fonction send information of the server to the client, but block the client informations to the server.
How to use it?
FireServer --> send informations client to server
FireClient --> send informations to specific client
FireAllClients -- > send informations to all clients of the server
Now know than Script (ServerScript) is for the server and LocalScript (ClientScript) for the client. And not inverse because that not work.
For your script, you don't have need a RemoteEvent
Script/ServerScript
script.Parent.MouseClick:Connect(function(player)
script.Parent.Parent:Destroy()
end)
Solved your question? Put in title [SOLVED] or accept a answer.
7 comments
Can you post your script?
Ok wait
local clickdetector = game.Workspace.Button.ClickDetector clickdetector.MouseClick:Connect(function() game.Workspace.DisableDoor:FireServer() end) – remote event inside Workspace game.Workspace.Door:Destroy() – here if i missed anything out tell me
Also sorry the code looks messy sorry for that
game.Workspace.Door:Destroy() is not a part of the function. Currently, it is set to fire immediately after the connection. Move the "end)" part to after the "Destroy()" to put it in your function.
the game.Workspace.Door:Destroy() is inside a script in a remote event i put it in replicated storage it doesnt fire automatically but now i cant fire it
"Scripts and LocalScripts will not run when they are parented to ReplicatedStorage..." Move it into the script in Workspace. Also you don't need a remote event if you are destroying it server side. If you are destroying it locally, it won't work in RS. https://developer.roblox.com/api-reference/class/ReplicatedStorage