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

What can I replace this localscript with something else?

Asked by 6 years ago

I have this localscript that when you click on a gui, your house doors opens up only to your roblox client. How do I make when the house doors open to the server?

Script:

function onButtonClicked()
local lock = game.Workspace:FindFirstChild("Home"..script.Parent.Parent.Parent.Parent.Parent.Name)
if not (lock) then
return
else
if script.Parent.Text == "Lock Doors" then
script.Parent.Text = "Unlock Doors"
lock.Home.FDoor.CanCollide = true
lock.Home.BDoor.CanCollide = true
lock.Home.GDoor.CanCollide = true
lock.Home.GarageDoor.CanCollide = true
elseif script.Parent.Text == "Unlock Doors" then
script.Parent.Text = "Lock Doors"
lock.Home.FDoor.CanCollide = false
lock.Home.BDoor.CanCollide = false
lock.Home.GDoor.CanCollide = false
lock.Home.GarageDoor.CanCollide = false
end
end
end
script.Parent.MouseButton1Click:connect(onButtonClicked)

Yes I know since it's a local script it only runs on the client.

1
You have to fire a remote event TheGreatSailor 20 — 6y
0
you need to keep your local script to detect when the player clicks the button, then you need to fire a remote event to the server. Then on the server you need a script to detect when the server event is fired and then you change the cancollide value in the door TheGreatSailor 20 — 6y
0
I suggest you to look at the answer I did to this question, it explains pretty well how Filtering Enabled works. https://scriptinghelpers.org/questions/55080/how-to-i-send-this-string-through-filteringenabled iDarkGames 483 — 6y

Answer this question