for _, v in pairs(ChangeRooms:GetChildren()) do
v.PrimaryPart.Touched:Connect(function(hit)
print('Touched')
end)
end
Inside a LocalScript in StarterPlayerScripts.
No clue why this fires for both players, even if only 1 touches it. From past experiences, .Touched when fired on the client, only responds to the client who touched it, not everyone, so not sure why it’s changed now?
Check if the Character who touched it is from the local Player.
for _, v in pairs(ChangeRooms:GetChildren()) do
v.PrimaryPart.Touched:Connect(function(hit)
local Char = hit.Parent
local Player = game:GetService("Players"):GetPlayerFromCharacter(Char)
if Player and Player == game:GetService("Players").LocalPlayer then
print('Touched')
end
end)
end
Or just check on the server who touched it, and use a RemoteEvent to tell the Client to open it.