The code works perfectly but I just tried it with my alt and it runs server side… why???
This is a snippet of the code.
local outside = workspace:WaitForChild("ClubOutsideView")
outside.Touched:Connect(function(hit)
show = true
doortouched = false
backpart.Transparency = 1
backpart.CanCollide = false
wait()
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
for _, part in pairs(firstfolder:GetChildren()) do
part.Transparency = .011
part.CanCollide = false
part.CastShadow = false
end
for _, part in pairs(sign:GetChildren()) do
part.Transparency = 0
part.CanCollide = true
part.CastShadow = true
end
for _, part in pairs(glassfolder:GetChildren()) do
part.Transparency = .9999
part.CanCollide = false
part.CastShadow = false
end
for _, part in pairs(folder:GetChildren()) do
part.Transparency = 1
part.CanCollide = false
part.CastShadow = false
end
for _, part in pairs(lights:GetChildren()) do
part.PointLight.Enabled = false
end
end
end)
I’m still having this issue. I disabled all plugins and other scripts. When my player touches a part, it changes transparency for everyone in the server not just me.
it executes the code when it got touched. Doesnt matter who touched it.
Do this
local outside = workspace:WaitForChild("ClubOutsideView")
local player = game.Players.LocalPlayer
outside.Touched:Connect(function(hit)
show = true
doortouched = false
backpart.Transparency = 1
backpart.CanCollide = false
wait()
local player2 = game.Players:GetPlayerFromCharacter(hit.Parent)
if player2 == player then
for _, part in pairs(firstfolder:GetChildren()) do
part.Transparency = .011
part.CanCollide = false
part.CastShadow = false
end
for _, part in pairs(sign:GetChildren()) do
part.Transparency = 0
part.CanCollide = true
part.CastShadow = true
end
for _, part in pairs(glassfolder:GetChildren()) do
part.Transparency = .9999
part.CanCollide = false
part.CastShadow = false
end
for _, part in pairs(folder:GetChildren()) do
part.Transparency = 1
part.CanCollide = false
part.CastShadow = false
end
for _, part in pairs(lights:GetChildren()) do
part.PointLight.Enabled = false
end
end
end)
this checks if player have touched the part and not some other player in the game
Right, but the reason I had it start from the client in the first place was because of the debounces, it makes sure the remoteevent only fires once per time the player touches it, and won’t loop while the player is still touching the part. I’m not sure how I could do that on server-side without it not firing for some people
local part = game.Workspace.Part
local Player = game.Players.LocalPlayer
part.Touched:Connect(function(touched)
if touched.Parent:FindFirstChild("Humanoid") and Player.Name == touched.Parent.Name then
--//--
--insert code here
end
end)
this should fully fix your problem.
add your code below the lines, and you can add debounce if you’d like.