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 4 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.

while true do
    wait(0.1)
function onTouched(Part)
game.StarterGui.cool.Disabled = true
end
end

Thanks

0
StarterGui or PlayerGui? BuDeep 214 — 4y

1 answer

Log in to vote
0
Answered by
Fifkee 2017 Community Moderator Moderation Voter
4 years ago
Edited 4 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:

game.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.

local function myFunction()
    return 'hi'
end;


local MyVariable = myFunction();
print(myFunction) --hi
Ad

Answer this question