Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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?

16 comments

0

time to be careful and try not to post lots of comments

0

time to be careful and try not to post lots of comments

0

?

0

i just have a bug where i post multiple comments with one click.

0

i just have a bug where i post multiple comments with one click.

0

i just have a bug where i post multiple comments with one click.

0

i just have a bug where i post multiple comments with one click.

0

i just have a bug where i post multiple comments with one click.

0

i just have a bug where i post multiple comments with one click.

0

see

0

see

0

see

0

see

0

see

0

try pressing enter instead

0

"try not to post lots of comments" dude 1 comment translates to like 10

2 answers

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)

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

4 comments

0

who downvoted this lol

0

whoever downvoted this, remove dat downvote

0

hey i dont post multiple comments now

0

hey i dont post multiple comments now

This discussion is preserved as it was. New answers, comments, and votes are closed.