Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
-4

Scripts work in studio but not in the actual game?

Asked by 5 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!

wait(2)
script.Parent.Text = "Welcome To Hill View City" .. " " .. Game.Players.LocalPlayer.Name
script.Parent:TweenPosition(UDim2.new(0,0,0,0))
wait(1)
script.Parent.Parent.Square.Script.Disabled = false
wait(1)
script.Parent:TweenPosition(UDim2.new(0.4, 0,0.225, 0))
wait(3)
script.Parent.Border.Disabled = false
repeat
    script.Parent.BorderSizePixel = 0
    wait(.01)
    script.Parent.BorderSizePixel = 1
    wait(.01)
    script.Parent.BorderSizePixel = 2
    wait(.01)
    script.Parent.BorderSizePixel = 3
    wait(.01)
    script.Parent.BorderSizePixel = 4
    wait(.01)
    script.Parent.BorderSizePixel = 5
    wait(.01)
    script.Parent.BorderSizePixel = 6
    wait(.01)
    script.Parent.BorderSizePixel = 7
    wait(.01)
    script.Parent.BorderSizePixel = 8
    wait(.01)
    script.Parent.BorderSizePixel = 9
    wait(.01)
    script.Parent.BorderSizePixel = 10
    wait(.01)
    script.Parent.BorderSizePixel = 11
    wait(.01)
    script.Parent.BorderSizePixel = 12
    wait(.01)
    script.Parent.BorderSizePixel = 13
    wait(.01)
    script.Parent.BorderSizePixel = 14
    wait(.01)
    script.Parent.BorderSizePixel = 15
    wait(.01)
    script.Parent.BorderSizePixel = 16
    wait(.01)
    script.Parent.BorderSizePixel = 17
    wait(.01)
    script.Parent.BorderSizePixel = 18
    wait(.01)
    script.Parent.BorderSizePixel = 19
    wait(.01)
    script.Parent.BorderSizePixel = 20
    wait(.01)
    script.Parent.BorderSizePixel = 21
    wait(.01)
    script.Parent.BorderSizePixel = 22
    wait(.01)
    script.Parent.BorderSizePixel = 23
    wait(.01)
    script.Parent.BorderSizePixel = 24
    wait(.01)
    script.Parent.BorderSizePixel = 25
    wait(.01)
    script.Parent.BorderSizePixel = 26
    wait(.01)
    script.Parent.BorderSizePixel = 27
    wait(.01)
    script.Parent.BorderSizePixel = 28
    wait(.01)
    script.Parent.BorderSizePixel = 29
    wait(.01)
    script.Parent.BorderSizePixel = 30
    wait(.01)
    script.Parent.BorderSizePixel = 31
    wait(.01)
    script.Parent.BorderSizePixel = 32
    wait(.01)
    script.Parent.BorderSizePixel = 33
    wait(.01)
    script.Parent.BorderSizePixel = 34
    wait(.01)
    script.Parent.BorderSizePixel = 35
    wait(.01)
    script.Parent.BorderSizePixel = 36
    wait(.01)
    script.Parent.BorderSizePixel = 37
    wait(.01)
    script.Parent.BorderSizePixel = 38
    wait(.01)
    script.Parent.BorderSizePixel = 39
    wait(.01)
    script.Parent.BorderSizePixel = 40
    wait(.01)
    script.Parent.BorderSizePixel = 41
    wait(.01)
    script.Parent.BorderSizePixel = 42
    wait(.01)
    script.Parent.BorderSizePixel = 43
    wait(.01)
    script.Parent.BorderSizePixel = 44
    wait(.01)
    script.Parent.BorderSizePixel = 45
    wait(.01)
    script.Parent.BorderSizePixel = 46
    wait(.01)
    script.Parent.BorderSizePixel = 47
    wait(.01)
    script.Parent.BorderSizePixel = 48
    wait(.01)
    script.Parent.BorderSizePixel = 49
    wait(.01)
    script.Parent.BorderSizePixel = 50
    wait(.01)
    script.Parent.BorderSizePixel = 51
    wait(.01)
    script.Parent.BorderSizePixel = 52
    wait(.01)
    script.Parent.BorderSizePixel = 53
    wait(.01)
    script.Parent.BorderSizePixel = 54
    wait(.01)
    script.Parent.BorderSizePixel = 55
    wait(.01)
    script.Parent.BorderSizePixel = 56
    wait(.01)
    script.Parent.BorderSizePixel = 57
    wait(.01)
    script.Parent.BorderSizePixel = 58
    wait(.01)
    script.Parent.BorderSizePixel = 59
    wait(.01)
    script.Parent.BorderSizePixel = 60
    wait(.01)
    script.Parent.BorderSizePixel = 61
    wait(.01)
    script.Parent.BorderSizePixel = 62
    wait(.01)
    script.Parent.BorderSizePixel = 63
    wait(.01)
    script.Parent.BorderSizePixel = 64
    wait(.01)
    script.Parent.BorderSizePixel = 65
    wait(.01)
    script.Parent.BorderSizePixel = 66
    wait(.01)
    script.Parent.BorderSizePixel = 67
    wait(.01)
    script.Parent.BorderSizePixel = 68
    wait(.01)
    script.Parent.BorderSizePixel = 69
    wait(.01)
    script.Parent.BorderSizePixel = 70
    wait(.01)
    script.Parent.BorderSizePixel = 71
    wait(.01)
    script.Parent.BorderSizePixel = 72
    wait(.01)
    script.Parent.BorderSizePixel = 73
    wait(.01)
    script.Parent.BorderSizePixel = 74
    wait(.01)
    script.Parent.BorderSizePixel = 75
    wait(.01)
    script.Parent.BorderSizePixel = 76
    wait(.01)
    script.Parent.BorderSizePixel = 77
    wait(.01)
    script.Parent.BorderSizePixel = 78
    wait(.01)
    script.Parent.BorderSizePixel = 79
    wait(.01)
    script.Parent.BorderSizePixel = 80
    wait(.01)
    script.Parent.BorderSizePixel = 81
    wait(.01)
    script.Parent.BorderSizePixel = 82
    wait(.01)
    script.Parent.BorderSizePixel = 83
    wait(.01)
    script.Parent.BorderSizePixel = 84
    wait(.01)
    script.Parent.BorderSizePixel = 85
    wait(.01)
    script.Parent.BorderSizePixel = 86
    wait(.01)
    script.Parent.BorderSizePixel = 87
    wait(.01)
    script.Parent.BorderSizePixel = 88
    wait(.01)
    script.Parent.BorderSizePixel = 89
    wait(.01)
    script.Parent.BorderSizePixel = 90
    wait(.01)
    script.Parent.BorderSizePixel = 91
    wait(.01)
    script.Parent.BorderSizePixel = 92
    wait(.01)
    script.Parent.BorderSizePixel = 93
    wait(.01)
    script.Parent.BorderSizePixel = 94
    wait(.01)
    script.Parent.BorderSizePixel = 95
    wait(.01)
    script.Parent.BorderSizePixel = 96
    wait(.01)
    script.Parent.BorderSizePixel = 97
    wait(.01)
    script.Parent.BorderSizePixel = 98
    wait(.01)
    script.Parent.BorderSizePixel = 99
    wait(.01)
    script.Parent.BorderSizePixel = 100
    wait(.01)
until
script.Parent.Parent.Visible == false
0
We can't use magic which means that we can't solve/answer your problem without seeing the code! UserOnly20Characters 890 — 5y
0
Its multiple codes alberthutchins 12 — 5y
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 — 5y

2 answers

Log in to vote
4
Answered by 5 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 — 5y
0
I think so. Please let me know if it does. capinbuilda 15 — 5y
0
It works, Thank you so much! :D alberthutchins 12 — 5y
Ad
Log in to vote
3
Answered by 5 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!

for i = 1,100,1 do
    script.Parent.BorderSizePixel = i
wait(0.1)
if script.Parent.Parent.Visible == false then
break 
    end 
end

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

0
Tab your code correctly! BlueTaslem 17922 — 5y
0
@BlueTaslem what do you mean by "Tab your code correctly!"?!? UserOnly20Characters 890 — 5y
0
@UserOnly16Characters, everything inside of the for loop needs to be indented. grasheeno 70 — 5y
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 — 5y
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 capinbuilda 15 — 4y

Answer this question