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

Touched:Connect(function() Client-side only ?

Asked by 5 years ago

I try to make a door that closes another door but I need a client sided script for that, maybe someone can help me with this?

0
time to be careful and try not to post lots of comments BashGuy10 384 — 5y
0
time to be careful and try not to post lots of comments BashGuy10 384 — 5y
0
? kipwater -8 — 5y
0
i just have a bug where i post multiple comments with one click. BashGuy10 384 — 5y
View all comments (12 more)
0
i just have a bug where i post multiple comments with one click. BashGuy10 384 — 5y
0
i just have a bug where i post multiple comments with one click. BashGuy10 384 — 5y
0
i just have a bug where i post multiple comments with one click. BashGuy10 384 — 5y
0
i just have a bug where i post multiple comments with one click. BashGuy10 384 — 5y
0
i just have a bug where i post multiple comments with one click. BashGuy10 384 — 5y
0
see BashGuy10 384 — 5y
0
see BashGuy10 384 — 5y
0
see BashGuy10 384 — 5y
0
see BashGuy10 384 — 5y
0
see BashGuy10 384 — 5y
0
try pressing enter instead royaltoe 5144 — 5y
0
"try not to post lots of comments" dude 1 comment translates to like 10 GGRBXLuaGG 417 — 5y

2 answers

Log in to vote
0
Answered by
BashGuy10 384 Moderation Voter
5 years ago

I would recommend something like this, k?

MAKE SURE THIS SCRIPT IS NOT IN THE WORKSPACE, somewhere like startergui works fine.

local door1 = 0 -- Replace 0 with the location of your door
local door2 = 0 -- Replace 0 with the location of your door

door1.Touched:Connect(function()
    door2.CanCollide = true
    door2.Transparency = 0


end)
Ad
Log in to vote
-1
Answered by 5 years ago

Well, this question truly depends on which script you enter this in.

For example, if ****code**** is inserted in a 'normal' script (server), each and every player would notice this change and this would be called: "Server Side".

But, if you were to insert ****code**** in a local script (client), only the player 'owning' this script gets to see the change, this would be called "Client Side".

****CODE:****

local door_part = nil -- Part of the door to control.

if door_part then door_part.Touched:Connect(function(hit) -- if there is a door in the script and this door part is touched then:
    if game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) then -- is a PLAYER touching the door's part? then:
        door_part.Transparency = 1; door_part.CanCollide = false -- Then, set the transparency to 1 and make the door not cancollidable.
    end
end)end
0
who downvoted this lol BashGuy10 384 — 5y
0
whoever downvoted this, remove dat downvote BashGuy10 384 — 5y
0
hey i dont post multiple comments now BashGuy10 384 — 5y
0
hey i dont post multiple comments now BashGuy10 384 — 5y

Answer this question