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
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
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".
As the guy above me said -FloweryMonkeyboy5-, I will recommend you using remote events and a Changed function.
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.
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
This discussion is preserved as it was. New answers, comments, and votes are closed.
4 comments
Do you mean in chat or gui? Because you write if script.Parent.text == ...
in gui
Ok but you need locate the gui first ...
wdym?