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

My script doesn't seem to be working right?

Asked by
Relatch 550 Moderation Voter
10 years ago

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

Log in to vote
4
Answered by 10 years ago

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
0
It works, but in-game it says Players.MrSmenryBackup.PlayerGui.nicekills.MainFrame.Backgr:6: attempt to index local 'plr' (a nil value) Relatch 550 — 10y
Ad

Answer this question