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

My script doesn't seem to be working right?

My script checks if a players Kills reach 2. When they do, it's supposed to show a gui on their screen.

Instead, when they get 2 kills, the gui doesn't show at all. Help?

local plr = game.Players.LocalPlayer

if plr.leaderstats.Kills.Value == 2 then
	plr.PlayerGui.nicekills.MainFrame.TextLabel:TweenPosition(UDim2.new(0, 0, 1, 0), "Out", "Bounce", 2)
end

1 answer

✓ Accepted answer

try making it fire when it changes cause its not looped so that can only check if the script is disabled. try

local plr = game.Players.LocalPlayer
moved = false
while true do
if moved == false and plr.leaderstats.Kills.Value == 2
then
moved = true
    plr.PlayerGui.nicekills.MainFrame.TextLabel:TweenPosition(UDim2.new(0, 0, 1, 0), "Out", "Bounce", 2)
end
end

1 comment

0

It works, but in-game it says Players.MrSmenryBackup.PlayerGui.nicekills.MainFrame.Backgr:6: attempt to index local 'plr' (a nil value)

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