generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Help Works in studio but not in game<

Previous Thread :: Next Thread 
GreedTaka is not online. 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 is not online. 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
LegitimatlyMe is not online. LegitimatlyMe
Joined: 30 Oct 2013
Total Posts: 1108
31 Mar 2015 07:33 PM
wait for character.
Report Abuse
GreedTaka is not online. GreedTaka
Joined: 12 Dec 2014
Total Posts: 1503
31 Mar 2015 07:33 PM
b1
Report Abuse
Funse is not online. 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 is not online. GreedTaka
Joined: 12 Dec 2014
Total Posts: 1503
31 Mar 2015 07:39 PM
do i turn it off?
Report Abuse
GreedTaka is not online. 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 is not online. GreedTaka
Joined: 12 Dec 2014
Total Posts: 1503
31 Mar 2015 08:00 PM
b2
Report Abuse
mycheeze is online. mycheeze
Joined: 27 Jun 2011
Total Posts: 6748
31 Mar 2015 08:00 PM
First question, does this output an error?
Report Abuse
GreedTaka is not online. GreedTaka
Joined: 12 Dec 2014
Total Posts: 1503
31 Mar 2015 08:09 PM
no,not in studio
Report Abuse
mycheeze is online. 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 is not online. 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 is online. 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 is not online. 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 is not online. 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
harvest109 is not online. harvest109
Joined: 19 Jun 2011
Total Posts: 869
31 Mar 2015 08:34 PM
repeat wait() until game.Players.LocalPlayer.Character ~= nil
At the top of the script please?
Report Abuse
GreedTaka is not online. GreedTaka
Joined: 12 Dec 2014
Total Posts: 1503
31 Mar 2015 08:38 PM
Thank you ^~^
Report Abuse
harvest109 is not online. harvest109
Joined: 19 Jun 2011
Total Posts: 869
31 Mar 2015 08:46 PM
No prob always add that to the top of localscripts <3
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image