Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

When a script only works in studio mode what are some general fixes?

Asked by
Smunkey 95
8 years ago

I couldn't find any threads for non-specific fixes to non-specific problems pertaining to this topic, so here's a thread for just that.

If a script is only working in studio mode what are the general fixes?

I know relay lag is fixed by putting the problem script into a local script, but what do you do if the problem script contains things that cant be used in a local script like changing health values? Besides maybe splitting your script into several smaller scripts and maybe some bool values.

I know some problems are caused if filtering is enabled, or maybe it is the other way around. Which is it? How can you enable/disable filtering?

Are there any other reasons you can think of for why a script only in works in studio? If you have fixes for those problems, what are they?

Are there any cases where a script works in a normal server but not in studio mode? Explain?

2 answers

Log in to vote
1
Answered by 8 years ago

You can toggle filtering under workspace as property FilteringEnabled.

Most of these issues can be debugged using Start server and Start player test options, as they will closely mimic actual game server scenario. Most of the weird things you mentioned will occour in Play solo.

What is most important is to understand that local script will only run on the player's machine itself, while regular script only runs on the server machine. If you want to make cool visual effects and animiations, you will want to do them on client side. Everything related to score handling, map loading should be trusted upon server.

In some cases filtering will make development harder, but it will help you think about this server and client relationship, which has generally been hidden by roblox. It is easier to learn scripting that way, but making a game is so much easier when client and server is completely serperated.

Also sometimes the issue is that local script has loaded before other objects have completely loaded, for example GUIs. For that you would probably want to use WaitForChild.

Ad
Log in to vote
0
Answered by 6 years ago

Sorry for reviving a old thread, but i actually need help. Same problem. I tried everything you said, but it doesn't seem to work.

I'm currently making an obby. I have stages on it, and it works out fine. But when i made a "Reset PROGRESS" button, as soon as i click it i go back to stage 1. As i should. Everything worked until i click the button. When i soon go to the next stage, nothing happens. I will still be on stage 1. Everything works perfect in solo mode tho. I don't get it? :(

Someone, pls help me.

Script for "stage" leaderboard and system:

`function oa(object) local player = game.Players:playerFromCharacter(object) if player ~= nil then local ls = player.leaderstats local sl = game.Workspace:FindFirstChild(ls.Stage.Value) print("gah") object.Torso.CFrame = object.Torso.CFrame + Vector3.new(0,3,0) wait() object.Torso.CFrame = sl.CFrame + Vector3.new(0,3,0) end end

function oe(object) if object.className == "Player" then local ack = Instance.new("IntValue") ack.Name = "leaderstats" local ack2 = Instance.new("IntValue") ack2.Name = "Stage" ack2.Value = 1 ack2.Parent = ack ack.Parent = object end end

game.Players.ChildAdded:connect(oe) game.Workspace.ChildAdded:connect(oa)`

script for each stage. 1, 2, 3 etc...

function ot(hit) if hit.Parent ~= nil then local player = game.Players:playerFromCharacter(hit.Parent) if player ~= nil then if player.leaderstats.Stage.Value == script.Parent.Name - 1 then local h = hit.Parent:FindFirstChild("Humanoid") if h ~= nil then if h.Health ~= 0 then player.leaderstats.Stage.Value = script.Parent.Name end end end end end end

script.Parent.Touched:connect(ot)

0
If you need help, you probably should of made a new thread. SilverCreeper58 23 — 6y

Answer this question