Hello Developers!
I don’t know whats wrong with this script!
Script:
local Check1 = script.Parent.Parent.Checkpoint1
local KillP = script.Parent
KillP.Touched:Connect(function(hit)
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Controls = Player.PlayerScripts:WaitForChild("ModuleScript"):GetControls()
Controls:Disable()
if hit.Parent:FindFirstChild("Humanoid") then
local HRP = hit.Parent:WaitForChild("HumanoidRootPart")
wait(0.2)
HRP.Position = Check1.Position + Vector3.new(0,3,0)
end
end)
---------------------------------------------------------------------------------------------------------
Thanks for reading!
My bad, I saw the LocalPlayer, although it is a localscript correct?
Also, your player’s controls are getting disabled whenever ANYTHING touches the KillP part.
Is this fine
local Check1 = script.Parent.Parent.Checkpoint1
local KillP = script.Parent
KillP.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Controls = Player.PlayerScripts:WaitForChild("ModuleScript"):GetControls()
wait(0.2)
Controls:Disable()
local HRP = hit.Parent:WaitForChild("HumanoidRootPart")
wait(0.2)
HRP.Position = Check1.Position + Vector3.new(0,3,0)
end
end)
You’ll also want to check if the humanoid belongs to the player, something like
local humanoid = hit.Parent:FindFirstChild(“Humanoid”)
local character = humanoid.Parent
local foundPlayer = game.Players:GetPlayerFromCharacter(character)
if foundPlayer and foundPlayer == Player then
– stuff
end