This does not work in game but in studio it works perfectly.. Idk what's wrong I've tried many solutions but idk...
BTW, ITS A LOCALSCRIPT.
PROBLEM: When I check in game logs I see something about the data model (client log)
"attempt to index local "char"
PLZ HELP!
Players = game.Players.LocalPlayer mouse = Players:GetMouse() local char = Players.Character local torso = char:findFirstChild("Torso") local leftarm = char:findFirstChild("Left Arm") enabled = true function onKeyDown(key) key = key:lower() if key == 'q' then local part = char["Left Arm"]:Clone() part.BrickColor = BrickColor.new("Institutional white") part.Material = "Neon" part.Name = "LeftArm2" part.CFrame = leftarm.CFrame part.Anchored = true part.CanCollide = false wait() part.Parent = char for i = 1, 10 do part.Size = part.Size +Vector3.new(0.1,0.1,0.1) part.Transparency = part.Transparency + 0.1 part.CFrame = leftarm.CFrame wait() end part:destroy() torso.Anchored = true leftarm.BrickColor = BrickColor.new('Really black') leftarm.Material = 'Neon' leftarm.Reflectance = 0.1 torso.Anchored = false end end enabled = false mouse.KeyDown:connect(onKeyDown)
Localscripts on the client can load prior to the actual character model loading, making line 4 error because 'char' is nil.. Try using a repeat
loop to wait until the Character has loaded.
local Players = game.Players.LocalPlayer local mouse = Players:GetMouse() repeat wait() until Players.Character --Wait until char has loaded local char = Players.Character local torso = char:findFirstChild("Torso") local leftarm = char:findFirstChild("Left Arm")