how can i connect the target function and player function into the server script so the server can bring the other player to me here is my local script
local player = game.Players.LocalPlayer
player.Chatted:Connect(function(msg)
local target --this would be the player that we're gonna tp to, its just a varibale to make things cleaner.
if msg:lower():match("goto") then
if game.Players:FindFirstChild(msg:sub(6)) then
target = workspace:FindFirstChild(msg:sub(6))
print(target)
player.Character.HumanoidRootPart.CFrame = CFrame.new(target.Head.Position)
end
end
end)
local player = game.Players.LocalPlayer
player.Chatted:Connect(function(msg)
local target --this would be the player that we're gonna tp to, its just a varibale to make things cleaner.
if msg:lower():match("get") then
if game.Players:FindFirstChild(msg:sub(6)) then
target = workspace:FindFirstChild(msg:sub(6))
print(target)
game:GetService("ReplicatedStorage"):WaitForChild("playertp").FireServer(player, target)
end
end
end)
here is my server script
game.ReplicatedStorage:WaitForChild("playertp").OnServerEvent:Connect(function(player, target)
target.HumanoidRootPart.CFrame = CFrame.new(player.Head.Position)
end)
i get no errors from this in-game

3 comments
the playertp in serverstorage is a remotefunction, i did also try it as a remoteevent with the exact same script
The remote event you fired from the local script has a different name from the one on the server script. Local scripts can't access ServerStorage, only server scripts can. Store the remote in ReplicatedStorage so both client and server can access it
ye i fixed both of those, i missed the name part and forgot about the replicated storage but even tho that is fixed the script dont work. pls help