I made this terrible code in attempts to make a script to give each player his/her own texture for a sword used here: Please help me correct it (AND I KNOW ITS WAY AND AND TERRIBLE :/ )
if game.workspace.Gamestart.Value == true then game.ReplicatedStorage.ClassicSword:Clone(localPlayer.BackPack) sword = script:FindFirstChild("TextureId") sword.Handle.Mesh.TextureId = (TextureId) end
TextureId
, and localPlayer
are never set. Clone
doesn't take any arguments either, IIRC.
I assume you want 'sword' set to the actual cloned sword, and the TextureId set to the value of script.TextureId
?
if game.workspace.Gamestart.Value then -- == true is not necessary for BoolValues local sword = game.ReplicatedStorage.ClassicSword:Clone() sword.Parent = game:GetService("Players").LocalPlayer.Backpack sword.Handle.Mesh.TextureId = script:WaitForChild("TextureId").Value end