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

Scripts aren't doing anything but printing?

Asked by
Troidit 253 Moderation Voter
9 years ago

I find my case a little strange:

Where do I start.. In game none of my scripts really DO ANYTHING except execute prints (that I put in so I can tell how far the script has gone).

HOWEVERin studio, not only does it execute the prints, but it also plays the audio I want it to play (a looped light bulb humming).

wait(5) --Waiting for client to load

print("Hum Script started")

local Hum = game.Soundscape.Hum

while true do --Intentional loop
    Hum:play()
    print("Hum Playing/Looped") 
    wait(10)
    Hum:Pause()
end

My next script:

wait(5) --Waiting for client to load

local me = game.StarterGui.ScreenGui.Title
local x = true

function apple (Text,WaitTime)
    me.Text = Text
    wait(WaitTime)
end

while true do --Intentional loop
    print("Started") --So I know it started
    wait(3)
    apple("please click Play?",4)
    apple("A Habit", 10)
    print("Ended") --So I know that the script went through
end

I have a menu screen for the game, and this script is supposed to change the header of the menu from "A Habit" to "please click play" and back to "A Habit" (for fun). It successfully does this as I can see it changes the text property of the TextLabel GUI to "please click play" but the header itself on the screen doesn't change.

wait(5)

print("Started Play") --So I know that the script EVEN STARTED
local me = game.StarterGui.ScreenGui.Start

me.MouseButton1Click:connect(function() --
    print("CLICKED!")   --Script entered function
    game.Workspace.CellLight:Destroy()
    wait(.1)
    game.Soundscape.HeGotPopped:Play()
    print("HE GOT POPPED!") -- Script finished function
end)

Last of the scripts, this one won't even TRIGGER if I click play on my menu. The play button is also a screen gui.

Here is a picture of the explorer where everything is. Explorer: http://prntscr.com/7quzra

Also, I'm not sure if this is related to my problems, but my Dev. Console gets flooded with messages like this: http://prntscr.com/7qv1vh (The last ones not on the first picture):http://prntscr.com/7qv25s

Please tell me if there's anything that needs explained or re-explained

0
I'm not sure I can help much, but when you are using "game.StarterGui.ScreenGui.Title" if you are trying to reach a gui for a player, you need to use LocalPlayer.PlayerGui.ScreenGui.Title. If you use the normal starter gui you are not reaching a gui in any players but just the actuall directory that stores the Guis. minikitkat 687 — 9y

1 answer

Log in to vote
0
Answered by
KoreanBBQ 301 Moderation Voter
9 years ago

Try using the Preload(id) method when the server starts to get your audio ID and even image IDs ready at the beginning.

Preload a method part of the ContentProvider service, so basically:

game:GetService("ContentProvider"):Preload(ID)

0
Thank you! Troidit 253 — 9y
Ad

Answer this question