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: Script working in solo but not in server

Previous Thread :: Next Thread 
davisky2 is not online. davisky2
Joined: 04 Mar 2012
Total Posts: 4710
12 Sep 2015 04:38 PM
Spent like 2 hrs on a long script that works completely fine in solo but doesnt work in server/play. No errors, nothing. It is just like a troll sitting on me.

These is the parts of the script that i think might be wrong?

...(code above too)
mouse = script.Parent.Parent.Parent.Parent.Parent.Parent:GetMouse()
...(moar code)
if --this function doesnt even want to work even though the value is "MLG"
game.ServerStorage.Settings.ClickType.Value == "MLG" then
script.Parent.Parent.Parent.MLGImages.Hitmarker.Position = UDim2.new(0,mouse.X-27,0,mouse.Y-20)
Crazyness() --Main function :/
wait(.25)
script.Parent.Parent.Parent.MLGImages.Hitmarker.Position = UDim2.new(1,0,0,0)
end
...(even moar code)



~davisky~
Report Abuse
davisky2 is not online. davisky2
Joined: 04 Mar 2012
Total Posts: 4710
12 Sep 2015 04:53 PM
pls halp ;-;


~davisky~
Report Abuse
davisky2 is not online. davisky2
Joined: 04 Mar 2012
Total Posts: 4710
13 Sep 2015 01:53 AM
y noone even tries to help me? ;-;


~davisky~
Report Abuse
davisky2 is not online. davisky2
Joined: 04 Mar 2012
Total Posts: 4710
13 Sep 2015 02:20 AM
Oh beautiful, now it sometimes errors in server saying that mouse is a nil value.


~davisky~
Report Abuse
GoogleAnalytics is not online. GoogleAnalytics
Joined: 08 Aug 2008
Total Posts: 455
13 Sep 2015 03:00 AM
LocalScript


local Player = game:GetService("Players").LocalPlayer -- not script.Parent.Parent.Parent its ugly.
local Mouse = Player:GetMouse()

-- Accessing server storage you need to use server side script for that remote event or something
-- Move ur frame from local.
Report Abuse
davisky2 is not online. davisky2
Joined: 04 Mar 2012
Total Posts: 4710
13 Sep 2015 05:42 AM
I dont think it will make a diffirence if i will replace script.Parent.... with .LocalPlayer.


~davisky~
Report Abuse
GoogleAnalytics is not online. GoogleAnalytics
Joined: 08 Aug 2008
Total Posts: 455
13 Sep 2015 08:56 AM
Maybe because you can't access the server stroage from local its server side then u cant access mouse either. Use waitforchild
Report Abuse
davisky2 is not online. davisky2
Joined: 04 Mar 2012
Total Posts: 4710
14 Sep 2015 09:12 AM
k i will try when i have time.
Report Abuse
davisky2 is not online. davisky2
Joined: 04 Mar 2012
Total Posts: 4710
14 Sep 2015 09:14 AM
Oh btw i can access the serverstorage by pressing the button. Because when i printed the value in serverstorage it was "MLG"...
Report Abuse
GoogleAnalytics is not online. GoogleAnalytics
Joined: 08 Aug 2008
Total Posts: 455
14 Sep 2015 09:20 AM
Don't trust studio its cursed no seriously server side acts like local script and vice-versa.
Report Abuse
davisky2 is not online. davisky2
Joined: 04 Mar 2012
Total Posts: 4710
14 Sep 2015 09:38 AM
I added this line after the :GetMouse() line... now the button doesnt work anymore...

script.Parent.Parent.Parent.Parent.Parent.Parent:WaitForChild(mouse)

I know i am doing this wrong.


~davisky~
Report Abuse
davisky2 is not online. davisky2
Joined: 04 Mar 2012
Total Posts: 4710
14 Sep 2015 09:52 AM
Again checked in-game what the problem is... made it also print something if the function get fired. It printed, but the function breaks at the next line:

#code script.Parent.Parent.Parent.MLGImages.Hitmarker.Position = UDim2.new(0,mouse.X-27,0,mouse.Y-20) -i hope i did Roblox+ feature right... if not here is the correct one :/

script.Parent.Parent.Parent.MLGImages.Hitmarker.Position = UDim2.new(0,mouse.X-27,0,mouse.Y-20)

And it errors by saying:
attempt to index global 'mouse' (a nil value)



~davisky~
Report Abuse
InsaneDays is not online. InsaneDays
Joined: 28 Jan 2012
Total Posts: 762
14 Sep 2015 10:08 AM
LocalScript = Client inputs(Mouse, KeyPress)
ServerScript = Server Client(Can access ServerStorage and stuff, can't get player mouse.)
Report Abuse
davisky2 is not online. davisky2
Joined: 04 Mar 2012
Total Posts: 4710
14 Sep 2015 10:28 AM
I changed the whole script to a localscript, but it errors at 2nd line now saying: SoundEffects is not (smthng) of ImageLabel.


local snd = script.Parent.Parent.Parent.SoundEffects.SelectMLG --ok, wth.


~davisky~
Report Abuse
davisky2 is not online. davisky2
Joined: 04 Mar 2012
Total Posts: 4710
14 Sep 2015 10:35 AM
Oh and btw, should i make RemoteEvent to a serverscript to check if the .Value is "MLG" or should i leave it in localscript?


~davisky~
Report Abuse
davisky2 is not online. davisky2
Joined: 04 Mar 2012
Total Posts: 4710
14 Sep 2015 10:55 AM
help me pls.


~davisky~
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
14 Sep 2015 10:57 AM
Use this for Studio testing
http://wiki.roblox.com/index.php?title=Debugging#Test_-.3E_Start

You can't access ServerStorage or ServerScriptService in a LocalScript. You can't use GetMouse in a Script. correct it.
Report Abuse
davisky2 is not online. davisky2
Joined: 04 Mar 2012
Total Posts: 4710
14 Sep 2015 11:01 AM
Ok, but that still doesnt explain why it errors on that line :L


~davisky~
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
14 Sep 2015 11:08 AM
Use WaitForChild.
Report Abuse
davisky2 is not online. davisky2
Joined: 04 Mar 2012
Total Posts: 4710
14 Sep 2015 11:56 AM
Ok thx for the help. But now there is small one problem.
It says :FireClient is not a valid member of LocalScript. :/

forSound:FireClient(player) --errors here...
forMems:FireClient(player)


~davisky~
Report Abuse
davisky2 is not online. davisky2
Joined: 04 Mar 2012
Total Posts: 4710
14 Sep 2015 12:33 PM
bump


~davisky~
Report Abuse
davisky2 is not online. davisky2
Joined: 04 Mar 2012
Total Posts: 4710
14 Sep 2015 12:51 PM
another bump


~davisky~
Report Abuse
davisky2 is not online. davisky2
Joined: 04 Mar 2012
Total Posts: 4710
14 Sep 2015 01:16 PM
no1 even looks here :(


~davisky~
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