I'm trying to teleport a horse model to a player, buy my code is giving me the error that's in the title.
Code:
script.Spawn.OnServerEvent:Connect(function(Player)
if not game.Workspace:FindFirstChild(Player.Name .. "'s Horse") and Player.Stats.HasHorse.Value == 1 then
local Horse = game:GetService("ReplicatedStorage").Horses.BasicHorse:Clone()
Horse.Name = Player.Name .. "'s Horse"
Horse.Parent = game.Workspace
Horse:MakeJoints() -- to make sure the horse doesn't fall apart
Horse:SetPrimaryPartCFrame(Player.Character.HumanoidRootPart.CFrame)
elseif game.Workspace:FindFirstChild(Player.Name .. "'s Horse") and Player.Stats.HasHorse.Value == 1 then
game.Workspace[Player.Name.."'s Horse"]:Destroy()
end
end)
Thanks for reading

2 comments
go to your model in properties press primary part then select your primary part
^