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

Not giving pet if text is == "TEST"?

Asked by 4 years ago
Edited 4 years ago

So I want then you write a word like TEST it gives you a pet but this script wont work!

local pet = game.Lighting.Pet1:Clone()
local plr = game.Players.LocalPlayer

if script.Parent.Text == "TEST" then
    pet.Parent = plr.Character
end
0
Do you mean in chat or gui? Because you write if script.Parent.text == ... robertruttar12 -115 — 4y
0
in gui robloxs_gamemaker 13 — 4y
0
Ok but you need locate the gui first ... robertruttar12 -115 — 4y
0
wdym? robloxs_gamemaker 13 — 4y

2 answers

Log in to vote
1
Answered by 4 years ago

Because this is a TextBox there is no Text by default in the TextBox yet. You most likely want a Changed listener to fire when the text is updated and then compare it to "TEST".

0
As the guy above me said -FloweryMonkeyboy5-, I will recommend you using remote events and a Changed function. tomer495 19 — 4y
0
Correct but could be explained better. Basicly "if" statements check once when they are run, so it will only check the text when the script is run. All instances have an event called Changed, that fires when one of it's attributes change. Use it to run the if statement when text is changed, instead of once. Benbebop 1049 — 4y
Ad
Log in to vote
-3
Answered by 4 years ago
Edited 4 years ago

it might be this one

local pet = game.Lighting.Pet1:Clone()
local plr = game.Players.LocalPlayer
local petplace = plr.Character
local gui = game.StarterGui."Gui Name"

if script.Parent.gui."Frame where is it or button".Text == "TEST" then
    pet.Parent = petplace.Parent
end

Answer this question