I made a functional bathroom stall: The player touches a part that opens the door, he walks automatically… Rest of the event (doesn’t matter).
Now, I disabled Player Controls just for MoveTo() work perfectly fine without player input. The bathroom stall works. But, the issue is when I reset or die after the I used the bathroom stall, I respawn, but I can’t move… There’s nothing I can do.
How can I move again after I used the bathroom stall?
These are my scripts:
- My main Script:
local ReplicatedStorage = game.ReplicatedStorage
local TweenService = game.TweenService
local Info = TweenInfo.new(1, Enum.EasingStyle.Quint)
local Model = script.Parent
local Door = Model.Door
local Hinge = Model.Hinge
local Toilet = Model.Toilet
local Seat = Toilet.Seat
local OccupiedBar = Door.OccupiedBar
local ActivePart = Model.ActivePart
local PositionPart = Model.PositionPart
local PositionPart2 = Model.PositionPart2
local PositionPart3 = Model.PositionPart3
local FlushingSound = Model.FlushingSound
FlushingSound.Parent = Seat
local Debounce = false
local OriginalDoorCFrame = Door.CFrame
local function Enter(hit)
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
local Humanoid = hit.Parent:FindFirstChildOfClass("Humanoid")
if Humanoid then
PositionPart2.CanTouch = false
TweenService:Create(Hinge, Info, {CFrame = Hinge.CFrame * CFrame.Angles(0, 0, math.rad(80))}):Play()
ReplicatedStorage.EtcRemotes.ToiletRemoteEvent:FireClient(Player, "Disable")
task.wait(0.5)
Humanoid:MoveTo(ActivePart.Position)
end
end
local function Leave(hit)
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
local Humanoid = hit.Parent:FindFirstChildOfClass("Humanoid")
if Humanoid and not Debounce then
Debounce = true
TweenService:Create(Hinge, Info, {CFrame = Hinge.CFrame * CFrame.Angles(0, 0, math.rad(-80))}):Play()
OccupiedBar.Color = Color3.fromRGB(255, 0, 0)
Seat:Sit(Humanoid)
Humanoid.Sit = true
ReplicatedStorage.EtcRemotes.ToiletRemoteEvent:FireClient(Player, "Disable")
ActivePart.CanTouch = false
task.wait(3)
FlushingSound:Play()
Humanoid.Sit = false
Humanoid:MoveTo(PositionPart.Position)
Humanoid.MoveToFinished:Wait()
OccupiedBar.Color = Color3.fromRGB(31, 128, 29)
task.wait(0.2)
TweenService:Create(Hinge, Info, {CFrame = Hinge.CFrame * CFrame.Angles(0, 0, math.rad(-80))}):Play()
Humanoid:MoveTo(PositionPart3.Position)
Humanoid.MoveToFinished:Wait()
TweenService:Create(Hinge, Info, {CFrame = Hinge.CFrame * CFrame.Angles(0, 0, math.rad(80))}):Play()
ReplicatedStorage.EtcRemotes.ToiletRemoteEvent:FireClient(Player, "Enable")
ActivePart.CanTouch = true
FlushingSound.Ended:Wait()
PositionPart2.CanTouch = true
Debounce = false
end
end
ActivePart.Touched:Connect(function(hit)
Leave(hit)
end)
PositionPart2.Touched:Connect(function(hit)
Enter(hit)
end)
- Toggle player controls script:
local ReplicatedStorage = game.ReplicatedStorage
local Player = game.Players.LocalPlayer
local function getControls()
return require(Player.PlayerScripts:WaitForChild("PlayerModule")):GetControls()
end
ReplicatedStorage.EtcRemotes.ToiletRemoteEvent.OnClientEvent:Connect(function(toggle)
local Controls = getControls()
if toggle == "Disable" then
Controls:Enable(false)
elseif toggle == "Enable" then
Controls:Enable(true)
end
end)
if Player.Character then
local Controls = getControls()
Controls:Enable(true)
end
Player.CharacterAdded:Connect(function()
local Controls = getControls()
Controls:Enable(true)
end)
And 1 Remote Event
The green parts are the activating part (PositionPart2 is also an activating part… yeah), the blue parts are positioning parts (Move to positioning,MoveTo()).
Best, XMLcard

