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

Scripts work in studio but not in the actual game?

Asked by 9 years ago

So i created some scripts and tested them in the studio, They worked perfectly fine so i published the game but then when i test the scripts in the actual game they don't work! PLEASE HELP!

1wait(2)
2script.Parent.Text = "Welcome To Hill View City" .. " " .. Game.Players.LocalPlayer.Name
3script.Parent:TweenPosition(UDim2.new(0,0,0,0))
4wait(1)
5script.Parent.Parent.Square.Script.Disabled = false
1wait(1)
2script.Parent:TweenPosition(UDim2.new(0.4, 0,0.225, 0))
3wait(3)
4script.Parent.Border.Disabled = false
001repeat
002    script.Parent.BorderSizePixel = 0
003    wait(.01)
004    script.Parent.BorderSizePixel = 1
005    wait(.01)
006    script.Parent.BorderSizePixel = 2
007    wait(.01)
008    script.Parent.BorderSizePixel = 3
009    wait(.01)
010    script.Parent.BorderSizePixel = 4
011    wait(.01)
012    script.Parent.BorderSizePixel = 5
013    wait(.01)
014    script.Parent.BorderSizePixel = 6
015    wait(.01)
View all 205 lines...
0
We can't use magic which means that we can't solve/answer your problem without seeing the code! UserOnly20Characters 890 — 9y
0
Its multiple codes alberthutchins 12 — 9y
0
There Happy? Don't see how the code is gonna help you if it has nothing special. If you plan on being negative just gtfo. Why would i want help from someone who can't help alberthutchins 12 — 9y

2 answers

Log in to vote
4
Answered by 9 years ago

If you're not already, make sure this is in a LocalScript, it's accessing the LocalPlayer.

0
Ok so if i put these into local scripts they should work? alberthutchins 12 — 9y
0
I think so. Please let me know if it does. SchonATL 15 — 9y
0
It works, Thank you so much! :D alberthutchins 12 — 9y
Ad
Log in to vote
3
Answered by 9 years ago

Here's a tip: Instead of all those script.Parent.BorderSizePixel use a for loops instead since its much for efficient for tasks like those!

1for i = 1,100,1 do
2    script.Parent.BorderSizePixel = i
3wait(0.1)
4if script.Parent.Parent.Visible == false then
5break
6    end
7end

PS: if you want to know more about for loops please feel free to ask below!

0
Tab your code correctly! BlueTaslem 18071 — 9y
0
@BlueTaslem what do you mean by "Tab your code correctly!"?!? UserOnly20Characters 890 — 9y
0
@UserOnly16Characters, everything inside of the for loop needs to be indented. grasheeno 70 — 9y
0
@grsheeno it doesn't need to be indented since the script works fine without being indented but I could see why it should be indented since it make the script easier to read. UserOnly20Characters 890 — 9y
0
Lol, I like how you write a thoughtful response and it doesnt get accepted. Then I just write a 1 sentence fix and gets accepted. gg SchonATL 15 — 9y

Answer this question