Hi, so around a few weeks ago I attempted to make the player change into a model (that could be changed). However, it didn’t exactly go to plan and I thought I’d come back to it to see what the issue with it is.
This is the script that is in ServerScriptService
local TestingBow = workspace.Bows.TestingBow
local camera = workspace.CurrentCamera
local RunService = game:GetService("RunService")
local plr = game.Players.LocalPlayer
game.Players.PlayerAdded:Connect(function(player) -- Player joins
player.CharacterAdded:Connect(function(character)
repeat RunService.Heartbeat:wait() until game:IsLoaded() -- Wait until the player has loaded
plr.Position = Vector3.new(2.8, 5.126, -37.2) -- Set the position of the player
plr.Character = TestingBow -- Set the players character to the bow
camera.CameraSubject = TestingBow.HumanoidRootPart -- Change the camera to be viewing the bow
camera.CameraType = Enum.CameraType.Follow
end)
end)
1: LocalPlayer is NOT accessible from Server scripts.
Just do it on the client, it’s easier.
LocalScript in starterPlayerScripts:
repeat wait() until game:IsLoaded()
local bow = workspace:WaitForChild("Bows"):WaitForChild("TestingBow")
local camera = workspace.CurrentCamera
runservice = game["Run Service"] or game:GetService("RunService")
local plr = game.Players.LocalPlayer
local char = player.Character
-- plr.Position is not a property
plr.Character = bow
char:SetPrimaryPartCFrame(CFrame.new(Vector3.new(2.8, 5.126, -37.2))) -- do this
camera.CameraSubject = char.HumanoidRootPart
camera.CameraType = Enum.CameraType.Follow
Hi thanks for the help, the only error I am getting at the moment is Players.GamingBoy113.PlayerScripts.LocalScript:1: attempt to index nil with 'Heartbeat'