✓ Accepted answer
Okay, just to iron out a few potential problems, im going to tell the script to halt until the remote events and such exist.
local replicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvents = replicatedStorage:WaitForChild("RemoteEvents")
local killerTrapRemote = remoteEvents:WaitForChild("KillerTrap")
local function giveModel(player, partFolder, green)
if player and parFolder then
local newPart = script:WaitForChild("StickModel"):Clone()
newPart.Name = player.Name.."'s Trap"
newPart.CFrame = player.Character:FindFirstChild("HumanoidRootPart").CFrame
newPart.Parent = workspace
wait(3)
newPart.Code.Disabled = false
end
end
killerTrapRemote.OnServerEvent:Connect(giveModel)
in your script, you werent accessing the player's character for the HumanoidRootPart, so I think that was the initial problem. To prevent any further issues, I added some functions that will make the script halt until they appear, so that you can avoid future errors similar to this.
When you use :FindFirstChild("HumanoidRootPart") on the player, it returns nil, because the player doesnt have a child called HumanoidRootPart. The character does, however.
2 comments
Could you provide the line for the error?
The model is actually an union part, so position must work, right?