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 » Scripting Helpers
Home Search
 

Re: This (for some reason) does not work in a Server

Previous Thread :: Next Thread 
Cjslick is not online. Cjslick
Joined: 11 Jul 2009
Total Posts: 2130
20 Aug 2013 03:11 PM
A=script.Parent.Ammo
r=script.Parent.Reload
ac=script.Parent.AC

function clip()
local ccc=script.Parent.Mag:clone()
ccc.Parent=game.Workspace
ccc.CFrame = script.Parent.Mag.CFrame - Vector3.new(0,1,0)
ccc.CanCollide = true
local r = script.Parent.RM:clone()
r.Parent = ccc
r.Disabled = false
print("IT COPIED")
end

r.Changed:connect(function()
if r.Value == true then
if ac.Value >= ammount then
Tool.Ready.Value = false
re=true
clip()
script.Parent.Mag.Transparency = 1
wait(4)
script.Parent.Mag.Transparency = 0
c.Value = ammount
ac.Value = ac.Value - ammount
A.Value = A.Value - 1
Tool.Ready.Value = true
r.Value=false
elseif ac.Value < 0 then
Tool.Ready.Value = false
re=true
clip()
script.Parent.Mag.Transparency = 1
wait(4)
script.Parent.Mag.Transparency = 0
c.Value = ammount
Tool.Ready.Value = true
r.Value=false
end
end
end)

it works fine in solo, but not in A Server Game
Report Abuse
mark298 is not online. mark298
Joined: 24 Oct 2008
Total Posts: 1264
20 Aug 2013 03:12 PM
If it works fine in solo, put it in a local script because all scripts in Solo are ran locally.
Report Abuse
MeBilly8440 is not online. MeBilly8440
Joined: 27 Jul 2009
Total Posts: 2783
20 Aug 2013 03:13 PM
Try adding wait(.2) to the beginning.

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
Cjslick is not online. Cjslick
Joined: 11 Jul 2009
Total Posts: 2130
20 Aug 2013 03:17 PM
@MeBilly: Right at the beginning?
Report Abuse
TheAviatorEagle is not online. TheAviatorEagle
Joined: 11 Aug 2013
Total Posts: 198
20 Aug 2013 03:18 PM
ds
Report Abuse
MeBilly8440 is not online. MeBilly8440
Joined: 27 Jul 2009
Total Posts: 2783
20 Aug 2013 03:19 PM
Yup. The most common reason for LocalScripts not working on online mode is that the objects they're referencing haven't been sent to the client yet. By that I mean:

Server: Sending script > Client
Client: Running script
Client: Where is everything else?
Server: Sending other parts > Client
Client: I'm already broken.

However, by adding a wait(.2) the client will have time for all the other parts to be loaded in.

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
Cjslick is not online. Cjslick
Joined: 11 Jul 2009
Total Posts: 2130
20 Aug 2013 03:43 PM
Making it local did not work, There's alot to the weapon but this is the part it usually doesn't work at.
Report Abuse
Cjslick is not online. Cjslick
Joined: 11 Jul 2009
Total Posts: 2130
20 Aug 2013 04:00 PM
Bump, PLEASE HELP!
Report Abuse
MeBilly8440 is not online. MeBilly8440
Joined: 27 Jul 2009
Total Posts: 2783
20 Aug 2013 04:21 PM
Make sure the script isn't disabled. Also, did you try my wait(.2) idea?

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
Cjslick is not online. Cjslick
Joined: 11 Jul 2009
Total Posts: 2130
21 Aug 2013 07:49 AM
It's not disabled, and I don't know exactly where to put the wait.
Report Abuse
Cjslick is not online. Cjslick
Joined: 11 Jul 2009
Total Posts: 2130
21 Aug 2013 08:37 AM
bump
Report Abuse
MeBilly8440 is not online. MeBilly8440
Joined: 27 Jul 2009
Total Posts: 2783
21 Aug 2013 10:58 AM
Put it at the very very beginning of your script. Before any functions.

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
MeBilly8440 is not online. MeBilly8440
Joined: 27 Jul 2009
Total Posts: 2783
21 Aug 2013 10:59 AM
@Myself
Or variables. Especially variables... Put it at the very top of your script. Only once, at the very top.

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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