Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Help me script errors?

This script test if i have in my leaderstats that if i have 0 value on my quest stats if it is the part is going to be visible.

leader = Game.Players:FindFirstChild("leaderstats")

while wait(.1) do
if leader.Quest.Value == 0 then
	script.Parent.Transparency = 0
else
	script.Parent.Transparency = 1
end
end

1 answer

✓ Accepted answer

Many errors there. I'll go through them.

1: 'Game' should be lowercase

2: 'leaderstats' isn't a child of Players, use game.Players.LocalPlayer:FindFirstChild('leaderstats') to access your own leaderstats

3: this should be a localscript, in StarterGui.. then access the part with workspace.Part

4: Use a Changed event to change the part's transparency, rather than a loop. Much more efficient.

wait(1) --keep this here

local leader = game.Players.LocalPlayer:FindFirstChild('leaderstats')
local part = workspace.Part --The part you're going to change

if leader.Quest.Value == 0 then part.Transparency = 0 else part.Transparency = 1 end

leader.Quest.Changed:connect(function(change)
	if change == 0 then
		part.Transparency = 0
	else
		part.Transparency = 1
	end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.