so i have this this that when you have 2 Kill Streak in the Leaderboard You Change the image
This is the script i got so far`
Script
while true do
local plr = game.Players.LocalPlayer
local KillStreak = plr:WaitForChild("leaderstats"):WaitForChild("Kill Streak")
if KillStreak == 2 then
script.Parent.FrameKill.KillImage.Image = "http://www.roblox.com/asset/?id=8454083149"
end
wait()
end
You already loaded the âleaderstatsâ, so why load âKill Streakâ when the âleaderstatsâ and the children of it are already loaded?
Hereâs a script:
local Player = game:GetService("Players").LocalPlayer
local KillStreak = Player:WaitForChild("leaderstats"):FindFirstChild("Kill Streak")
if KillStreak.Value == 2 then
script.Parent.FrameKill.KillImage.Image = "http://www.roblox.com/asset/?id=8454083149"
end
local Player = game:GetService("Players").LocalPlayer
local KillStreak = Player:FindFirstChild("leaderstats"):FindFirstChild("Kill Streak")
if KillStreak.Value == 2 then
script.Parent.FrameKill.KillImage.Image = "http://www.roblox.com/asset/?id=8454083149"
end
Why are you trying to access the local player on a normal script?
Delete the old script, and make a local script with the following code:
local plr = game.Players.LocalPlayer
local KillStreak = plr:WaitForChild("leaderstats"):WaitForChild("Kill Streak")
if KillStreak == 2 then
script.Parent.FrameKill.KillImage.Image = "http://www.roblox.com/asset/?id=8454083149"
end
KillStreak:GetPropertyChangedSignal('Value'):Connect(function()
if KillStreak == 2 then
script.Parent.FrameKill.KillImage.Image = "http://www.roblox.com/asset/?id=8454083149"
end
end)
Sorry to bring this topic again, you canât access âLocalPlayerâ in a SERVER Script. You can only access âLocalPlayerâ in a LOCAL Script. So that explains why the Player variable is nil.