Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Why is the script killing me when I try to weld it up?

Asked by 9 years ago
01local lplayer = game.Players.LocalPlayer
02 
03local HumT = lplayer.Character.Torso
04 
05local RepStore = game:GetService("ReplicatedStorage")
06 
07 
08local Players = game:GetService("Players")
09 
10function OnPlayerAdded(plr)
11    print("Hello!")
12 
13local part2 = RepStore.Blocky:Clone()
14 
15 
View all 32 lines...

It kills me when I try to weld a part to the Character's Torso. Each time I respawn.

0
I have on ReplicatedStorage a 2x2x2 part named "Blocky" as you might see. I'm trying to clone it and weld it to the Character's Torso. But for some strange reason when I press "play" the character spawns and it instantly dies, and it doesn't stop loop killing me, any help on this ? iDarkGames 483 — 9y

1 answer

Log in to vote
0
Answered by
Pyrondon 2089 Game Jam Winner Moderation Voter Community Moderator
9 years ago

You set the player's torso to the player, which is why it kept killing them. The torso doesn't need to be parented. You also forgot to set the parent of the weld.

And I'm not sure why it even worked, because in lines 31-33, you used 'plr' which wasn't defined. If you're trying to loop through the players and do it for all of them, then substitute plr with v, as I did. You should also connect the function to the actual player added event, which I assume is what you wanted to do from 'OnPlayerAdded', as right now it'll only run once.

01local lplayer = game.Players.LocalPlayer
02 
03local HumT = lplayer.Character.Torso
04 
05local RepStore = game:GetService("ReplicatedStorage")
06 
07 
08local Players = game:GetService("Players")
09 
10function OnPlayerAdded(plr)
11    print("Hello!")
12 
13local part2 = RepStore.Blocky:Clone()
14part2.Parent = game.Workspace
15 
View all 36 lines...
0
It shows up with this error: "Workspace.Blocky to Workspace.Blocky.Torso would result in circular reference " iDarkGames 483 — 9y
0
I made about a billion mistakes, pretty sure I just fixed it again. My fault! Pyrondon 2089 — 9y
0
Thanks Pyrondon. Very helpfull! iDarkGames 483 — 9y
0
No problem. Pyrondon 2089 — 9y
Ad

Answer this question