Hi. I’m trying to create a script that when you touch a pressure, it fires a remote event to open the door, but then once you step off it, it closes. I’m unsure on why the functions aren’t being called when it’s being touched. Any idea why?
PS. I’m kind of a beginner, so if you could explain simply that’d be nice.
ReplicatedStorage = game:GetService("ReplicatedStorage")
Step = ReplicatedStorage.Pressure1step
Off = ReplicatedStorage.Pressure1off
local function step()
print("step called")
Step:FireServer()
print("fired step")
end
local function off()
print("off called")
Off:FireServer()
print("fired off")
end
script.Parent.Touched:Connect(step)
script.Parent.TouchEnded:Connect(off)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Step = ReplicatedStorage:WaitForChild("Pressure")
local function step()
print("step called")
Step:FireServer(true)
print("fired step")
end
local function off()
print("off called")
Step:FireServer(false)
print("fired off")
end
script.Parent.Touched:Connect(step)
script.Parent.TouchEnded:Connect(off)
Also, you could shorten that and have a single remote for it. Just pass true/false accordingly and act accordingly on the server side aswell.