I made this script a while ago, and it's supposed to SIMPLY create a part and weld it to player's left hand. The thing is that i have no idea on how to fix the error and i already tried a lot of solutions that didn't work. Here's the script:
Script:
game.Players.PlayerAdded:Connect(function(player) local part = Instance.new("Part", workspace) local weld = Instance.new("Weld", part) weld.Part0 = part weld.Part1 = game.Workspace.player["LeftHand"] weld.C0 = CFrame.new(0, 0, 0) *CFrame.new(0, 0, 0) end)
Error:
player is not a valid member of Workspace
I would be glad if anyone help, because i've been trying for a long time and i keep getting errors.
:(
PS: Everything except for that error works because i already tested with my own username.
you could do
game.Players.PlayerAdded:Connect(function(player) local part = Instance.new("Part", workspace) local weld = Instance.new("Weld", part) weld.Part0 = part weld.Part1 = game.Workspace:WaitForChild(player.Name)["LeftHand"] weld.C0 = CFrame.new(0, 0, 0) *CFrame.new(0, 0, 0) end)
wait for the player's character to be spawned then weld it
Player is considered to be the Player Object rather than the Player Model in Workspace. I recommend changing line 6 to player:WaitForChild("Character"):WaitForChild("Left Hand")