Basically what I was trying to do was script a system that when a player touched the detector it would take them to the seat, kind of similar to most camping games system,
I made the changes to my script and and tried to find out what the issue was
function onTouch(hit)
local player = hit.Parent:FindFirstChild(“Humanoid”)
–player.Torso:Destroy()
script.Parent.Transparency = 0
player.Character:SetPrimaryPartCFrame(CFrame.new(0,500,0))
end
script.Parent.Touched:Connect(onTouch)
I Tried Setting the CFrame to a number but nothing happened, TouchEvent occured but the player didn’t teleport
This happens because you can’t change the CFrame of a humanoid, try this:
function onTouch(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
script.Parent.Transparency = 0
player.Character:SetPrimaryPartCFrame(CFrame.new(seatCFrame))
end
end
script.Parent.Touched:Connect(onTouch)
function onTouch(hit)
local human = hit.Parent:FindFirstChild("Humanoid")
if human then
script.Parent.Transparency = 0
hit.Parent:SetPrimaryPartCFrame(CFrame.new(seatCFrame))
end
end