- What do you want to achieve?
I am making a tool that spawns a model on the player’s HumanoidRootPart when activated.
- What is the issue?
when i run this code:
local function onPlayerAdded()
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local chair = game.ReplicatedStorage.epic_chair
local IsChairSpawned = false
local tool = script.Parent
print "yes"
local function spawnchair()
local positionArray = {character.HumanoidRootPart.Position}
local chairclone = chair:Clone()
chairclone.Parent = game.Workspace
chairclone.Position = positionArray[1]
local IsChairSpawned = true
end
while(true)do
if tool.Activated then
if not IsChairSpawned then
spawnchair()
end
end
end
end
game.Players.LocalPlayer.CharacterAdded:Connect(onPlayerAdded())
It gives me the error in the title.
- What solutions have you tried so far?
I’ve tried looking all over the DevForum for help but i could not find anything.
What am I doing wrong here?
Edit: the Error is on line 13