#I don't know why but when I restart or change characters this script stops working

72 messages · Page 1 of 1 (latest)

outer escarp
#

I think I know something that could help

#

in the screengui the textbutton is in there should be something in the properties tab called reset on spawn or something like that

#

try toggling that off

#

@hoary moon

hoary moon
#

I am going to try

#

Still not working

wanton pelicanBOT
#

studio** You are now Level 1! **studio

ember nexus
#

print player

#

is it nil

#

if it is, then use game:GetService("Players").LocalPlayer

shy dagger
hoary moon
ember nexus
#

print player

shy gate
ember nexus
#

But what if it ios

hoary moon
ember nexus
#

print(plr)

shy gate
ember nexus
#

But what if it is

shy gate
#

try turning off resetonspawn in the screenguis properties

shy gate
ember nexus
#

put the player in the while wait loop

shy gate
#

unnecessary

#

it wont be nil

#

there is nothing changing it

wanton pelicanBOT
#

studio** You are now Level 16! **studio

shy gate
#

so it cant be nil

ember nexus
#

It will

shy gate
#

no

ember nexus
#

Do you know?

shy gate
#

in my 5 years of scripting never once has localplayer been nil

ember nexus
#

But no GetService

shy gate
#

yeah

#

its unnecessary

ember nexus
#

Getservice is unnecessary??

#

What have you been doing for five years cuh

shy gate
#

never used it once for players

ember nexus
#

Why are you ignoring good practice for players

#

Why

#

Not safe

shy gate
#

its not a good practice if unnecessary

#

game.players works just as well

#

and is shorter

#

and easier

ember nexus
#

0k

hoary moon
#

it still doesn't work xd

shy gate
ember nexus
#

Is the badge id correct

#

@hoary moon

shy gate
#

so not the case

hoary moon
#

I have already tried to redo the script several times but nothing, could any of you help me do something similar?

hoary moon
#

No

stone panther
#

Don't use while wait

#

Use

local Run = game:GetService("RunService")
local Badge = game:GetService("BadgeService")
local Players = game:GetService("Players")

local player = Players.LocalPlayer
local BADGE_ID = 2153409903

local function CheckBadge()
  script.Parent.Visible = Badge:UserHasBadgeAsync(player.UserId, BADGE_ID)
end

Run.HeartBeat:Connect(CheckBadge)
hoary moon
#

Tysm , I'll try it when I get back

hoary moon
#

it still doesn't work. :(((

wanton pelicanBOT
#

studio** You are now Level 2! **studio

spare jay
#

hello

#

i can try helping

#

whats wrong with it

spare jay
#

my rough assumption if that what if u put the localplayer in the heartbeat instead, so u can like check for the character since it changes

spare jay
#

i do kno dud

#

I dont know exactly what your problem is and what you are trying to make and what u did so i cant give a logical solution?

#

hope it helps

#

its 2am rn and im just trying to sleep

hoary moon
#

I didn't understand anything but thanks for trying to help