GreedTaka
|
  |
| Joined: 12 Dec 2014 |
| Total Posts: 1503 |
|
|
| 31 Mar 2015 07:21 PM |
in game output- attempt to index global 'c'(a nil value) line 8
works great in studio but when i test in a game it doesn't work
s = script.Parent p = s.Parent c = p.Character m = p:GetMouse() charging = false --[[Needed]]
--[[CFraming]]-- bd = c.HumanoidRootPart.RootJoint -- this a1 = c.Torso:FindFirstChild("Left Shoulder") a2 = c.Torso:FindFirstChild("Right Shoulder") l1 = c.Torso:FindFirstChild("Left Hip") l2 = c.Torso:FindFirstChild("Right Hip")
function ResetWelds() bd.C0 = bd.C1 * CFrame.new(0,0,0) a1.C0 = a1.C1 * CFrame.new(0,0,1.5) a2.C0 = a2.C1 * CFrame.new(0,0,1.5) l1.C0 = l1.C1 * CFrame.new(0,-2,0.5) l2.C0 = l2.C1 * CFrame.new(0,-2,0.5) end
function Charge() if charging == false then charging = true script.SoundLoop:Play() c.Humanoid.WalkSpeed = c.Humanoid.WalkSpeed * 0.5 for i = 1,5 do wait() a1.C0 = a1.C0 * CFrame.Angles(-0.2,0,0) a2.C0 = a2.C0 * CFrame.Angles(-0.2,0,0) end local ki = Instance.new("Part") ki.Size = Vector3.new(2, 2, 1) ki.Material = "SmoothPlastic" ki.Transparency = 0.5 ki.BrickColor = BrickColor.new("Toothpaste") ki.Reflectance = 0.5 ki.CanCollide = true ki.TopSurface = "Smooth" ki.BottomSurface = "Smooth" local msh = Instance.new("SpecialMesh") msh.MeshType = "Sphere" msh.Scale = Vector3.new(5,5,10) msh.Parent = ki local w = Instance.new("Weld") w.Part0 = ki w.Part1 = c.Torso w.Parent = ki ki.Parent = c while charging == true do wait() w.C0 = w.C0 * CFrame.Angles(0,-0.75,-0.75) if charging == false then --[[What Happens]] script.SoundLoop:Stop() ki:Destroy() c.Humanoid.WalkSpeed = c.Humanoid.WalkSpeed * 2 ResetWelds() end end end end
m.KeyDown:connect(function(key) if string.byte(key) == 48 then --[[SpaceBar]] Charge() end end)
m.KeyUp:connect(function(key) if string.byte(key) == 48 then charging = false --[[Stop Charging]] end end) |
|
|
| Report Abuse |
|
|
GreedTaka
|
  |
| Joined: 12 Dec 2014 |
| Total Posts: 1503 |
|
|
| 31 Mar 2015 07:25 PM |
| can test it yourself, just put in a local script - then press down on shift in studio |
|
|
| Report Abuse |
|
|
| |
|
GreedTaka
|
  |
| Joined: 12 Dec 2014 |
| Total Posts: 1503 |
|
| |
|
Funse
|
  |
| Joined: 11 Jun 2012 |
| Total Posts: 7887 |
|
|
| 31 Mar 2015 07:34 PM |
| If filteringenabled is on, the changes you did on this script will not show up on the server. |
|
|
| Report Abuse |
|
|
GreedTaka
|
  |
| Joined: 12 Dec 2014 |
| Total Posts: 1503 |
|
| |
|
GreedTaka
|
  |
| Joined: 12 Dec 2014 |
| Total Posts: 1503 |
|
|
| 31 Mar 2015 07:45 PM |
| bump i mean it works when i test on the server in studio but not when i update to my place and play! |
|
|
| Report Abuse |
|
|
GreedTaka
|
  |
| Joined: 12 Dec 2014 |
| Total Posts: 1503 |
|
| |
|
mycheeze
|
  |
| Joined: 27 Jun 2011 |
| Total Posts: 6748 |
|
|
| 31 Mar 2015 08:00 PM |
| First question, does this output an error? |
|
|
| Report Abuse |
|
|
GreedTaka
|
  |
| Joined: 12 Dec 2014 |
| Total Posts: 1503 |
|
| |
|
mycheeze
|
  |
| Joined: 27 Jun 2011 |
| Total Posts: 6748 |
|
|
| 31 Mar 2015 08:12 PM |
Then you should use the local console for your game to document the error.
Then provide me the output <3 |
|
|
| Report Abuse |
|
|
drager980
|
  |
| Joined: 25 May 2009 |
| Total Posts: 13385 |
|
|
| 31 Mar 2015 08:14 PM |
| probably has to do with the character not loading yet, so c is nil. |
|
|
| Report Abuse |
|
|
mycheeze
|
  |
| Joined: 27 Jun 2011 |
| Total Posts: 6748 |
|
|
| 31 Mar 2015 08:17 PM |
| Obviously it w00d b nil, I'm just concerned if this script is ran after everything is loaded by enabling it |
|
|
| Report Abuse |
|
|
drager980
|
  |
| Joined: 25 May 2009 |
| Total Posts: 13385 |
|
|
| 31 Mar 2015 08:19 PM |
| the quick-e solution is waiting for character if you haven't realised |
|
|
| Report Abuse |
|
|
GreedTaka
|
  |
| Joined: 12 Dec 2014 |
| Total Posts: 1503 |
|
|
| 31 Mar 2015 08:26 PM |
There is not one in the local either
it doesnt even print("Chargeing") in it
s = script.Parent p = game.Players.LocalPlayer c = p.Character m = p:GetMouse() charging = false --[[Needed]] repeat wait() until c --[[CFraming]]-- bd = c.HumanoidRootPart.RootJoint a1 = c.Torso:FindFirstChild("Left Shoulder") a2 = c.Torso:FindFirstChild("Right Shoulder") l1 = c.Torso:FindFirstChild("Left Hip") l2 = c.Torso:FindFirstChild("Right Hip")
function ResetWelds() bd.C0 = bd.C1 * CFrame.new(0,0,0) a1.C0 = a1.C1 * CFrame.new(0,0,1.5) a2.C0 = a2.C1 * CFrame.new(0,0,1.5) l1.C0 = l1.C1 * CFrame.new(0,-2,0.5) l2.C0 = l2.C1 * CFrame.new(0,-2,0.5) end
function Charge()
if charging == false then charging = true script.SoundLoop:Play() c.Humanoid.WalkSpeed = c.Humanoid.WalkSpeed * 0.5 for i = 1,5 do wait() a1.C0 = a1.C0 * CFrame.Angles(-0.2,0,0) a2.C0 = a2.C0 * CFrame.Angles(-0.2,0,0) end local ki = Instance.new("Part") ki.Size = Vector3.new(2, 2, 1) ki.Material = "SmoothPlastic" ki.Transparency = 0.5 ki.BrickColor = BrickColor.new("Toothpaste") ki.Reflectance = 0.5 ki.CanCollide = true ki.TopSurface = "Smooth" ki.BottomSurface = "Smooth" local msh = Instance.new("SpecialMesh") msh.MeshType = "Sphere" msh.Scale = Vector3.new(5,5,10) msh.Parent = ki local w = Instance.new("Weld") w.Part0 = ki w.Part1 = c.Torso w.Parent = ki ki.Parent = c while charging == true do wait() w.C0 = w.C0 * CFrame.Angles(0,-0.75,-0.75) if charging == false then --[[What Happens]] script.SoundLoop:Stop() ki:Destroy() c.Humanoid.WalkSpeed = c.Humanoid.WalkSpeed * 2 ResetWelds() end end end end
m.KeyDown:connect(function(key) if key == "z" then print("Chargeing") Charge() end end)
m.KeyUp:connect(function(key) if key == "z" then charging = false --[[Stop Charging]] end end) |
|
|
| Report Abuse |
|
|
|
| 31 Mar 2015 08:34 PM |
repeat wait() until game.Players.LocalPlayer.Character ~= nil At the top of the script please? |
|
|
| Report Abuse |
|
|
GreedTaka
|
  |
| Joined: 12 Dec 2014 |
| Total Posts: 1503 |
|
| |
|
|
| 31 Mar 2015 08:46 PM |
| No prob always add that to the top of localscripts <3 |
|
|
| Report Abuse |
|
|