What do you want to achieve? Keep it simple and clear!
I want it to kick the local player if their textlabel text is 100
What is the issue? Include screenshots / videos if possible!
theres no error and is not kicking the player.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried looking for solutions via the devforum and I also google it but I couldn’t find the things related to my problems.
I hope someone could help me with this…
Thank you and have a nice day ahead!
local Fade = game.Players.LocalPlayer.PlayerGui:WaitForChild("Fade")
local Text = script.Parent.Text
if Text == "100" then
game.Players.LocalPlayer:Kick()
end
local Fade = game.Players.LocalPlayer.PlayerGui:WaitForChild("Fade")
local Text = script.Parent.Text
local function check()
if Text == "100" then
game.Players.LocalPlayer:Kick()
end
end
check()
script.Parent:GetPropertyChangedSignal("Text"):Connect(function()
check()
end)
your code seems fine. but to check the error you can change it to a normal script in the
ServerScriptService and do this:
local Fade = game.Players.LocalPlayer.PlayerGui:WaitForChild("Fade")
local Text = script.Parent.Text --[[ here put the textLabel location
and then add .Text]]
print("check1 - succes")
wait(5)
if Text == "100" then
print("text is 100!")
for i, v in pairs(game.Players:GetChildren()) do
v:Kick()
end
print("succes!")
else
print("text is not 100, text:")
print(Text)
end
-- and tell us the output
Alright so there could be multiple issues with this, but I’m gonna have to get assumptions in first.
I’m assuming that
local Fade = game.Players.LocalPlayer.PlayerGui:WaitForChild("Fade")
local Text = script.Parent -- This is the text object (again, assumption)
if Text.Text == "100" then
game.Players.LocalPlayer:Kick()
end
I believe what’s happening is that you’re referencing the Text of the TextLabel once in your script which literally gets you what the text was at that time, what you might need is a function which checks it whenever you require, which can obviously be used with the method I showed above. Or you can use this method also:
local Text = scrit.Parent
local function Check()
if Text.Text == "100" then
game.Players.LocalPlayer:Kick()
end
end
This allows you to use this code multiple lines without redundancy! Anyways, hope this helped.