I'm having problems with the .Touched event, when i touch the part its delayed by 1 second or more, this is a single player so if there is a way so that if one client jumps on a brick only the client will see and can jump on the brick but not other clients i would use it. Here is the script i used.
Local function OnTouch () script.Parent.Transparency = 0.5 script.Parent.Parent.Part1.Transparency = 0.5 script.Parent.Parent.Part1.CanCollide = true wait(0.2) script.Parent.Transparency = 1 script.Parent.CanCollide = false script.Parent.parent.Part1.Transparency = 0 wait(5) script.Parent.Transparency = 0 script.Parent.CanCollide = true script.Parent.Parent.Transparency = 1 script.Parent.Parent.CanCollide = false end script.parent.touched.connect (OnTouch)
-- Declaration Section local Workspace = game:GetService("Workspace") -- //Part local Part1 = Workspace:WaitForChild("Part1") local Part2 = Workspace:WaitForChild("Part2") -- Processing Section local function ChangePartProperties (hit) if hit.Parent:FindFirstChild("Humanoid") then Part1.Transparency = 0.5 Part2.Transparency = 0.5 Part2.CanCollide = false wait(0.2) Part1.Transparency = 1 Part2.Transparency = 1 Part2.CanCollide = true wait(0.2) Part1.Transparency = 0 Part2.Transparency = 0 Part2.CanCollide = false end end -- Connecting Section Part1.Touched:Connect(ChangePartProperties)
Avoid using
connect
as it is depreciated. UseConnect
.It is not
Local
but ratherlocal
.I personally despise
script.Parent
so I changed it up.
But you should immediately see some changes after these small fixes.