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

Why is the script in startergui not disabling?

Asked by 5 years ago

Im trying to disable a script from the StarterGui (the field of view playbackloudness) with the script of the playbackloudness is notwing wrong because it works fine for me im using a normal script.

1while true do
2    wait(0.1)
3function onTouched(Part)
4game.StarterGui.cool.Disabled = true
5end
6end

Thanks

0
StarterGui or PlayerGui? BuDeep 214 — 5y

1 answer

Log in to vote
0
Answered by
Fifkee 2017 Community Moderator Moderation Voter
5 years ago
Edited 5 years ago

StarterGui is not an active instance. It only duplicates itself into a player's PlayerGui when a player spawns.

Utilize the PlayerGui instead of the StarterGui:

1game.Players.LocalPlayer.PlayerGui

Also--I just noticed, you define a function but never call it. Function blocks only run when they are called. Call a function by attaching parenthesis at the end of the name.

1local function myFunction()
2    return 'hi'
3end;
4 
5 
6local MyVariable = myFunction();
7print(myFunction) --hi
Ad

Answer this question