ive tried to do that by doing this (dont laugh at me I dont know what im doing)
script.Parent.Equipped:Connect(function(plr) local tp = plr.Parent:FindFirstChild("Humanoid") if tp then local tp1 = plr.Parent:FindFirstChild("HumanoidRootPart") if tp1 then tp1.CFrame = Vector3.new(27949.941, 52.029, -708.888) end end end) script.Parent.Unequipped:Connect(function() -- will basically be the opposite of above end)
I know that when you want something to happen when you touch a part, you would do something similar to what I did above. (I basically used pre-existing knowledge to try and figure this one out which doesn't seem to work) anyway, in the dev console it says "attempt to index nil with FindFirstChild" which leads to believe I've done something wrong with the parameters. How would I fix this
Server Script
script.Parent.Equipped:Connect(function() local Character = script.Parent.Parent local HRP = Character.HumanoidRootPart HRP.CFrame = CFrame.new(Vector3.new(27949.941, 52.029, -708.888)) end)
You could also add a debounce if you don't want the player to spam it.
local tool = script.Parent tool.Equipped:Connect(function() -- teleport code here end)
Maybe reparent the tool after teleporting or consider using activated to prevent it trying to teleport u again while still equipped.
Hello, quinzt! The problem is the Equipped
event gets a parameter of the player's mouse, not the actual player itself. Instead, use a LocalScript
with LocalPlayer
. This would still work even with FE. Try this:
local player = game:GetService("Players").LocalPlayer script.Parent.Equipped:Connect(function(mouse) local character = player.Character or player.CharacterAdded:Wait() character:SetPrimaryPartCFrame(CFrame.new(27949.941, 52.029, -708.888)) end)
If this helped you please accept this answer.