I'm very bad at scripting, I'm mostly a builder/modeler solo dev, so scripting has always been something I've struggeled with. I'm having an issue with a script in my game that I'm developing. I have a phone tool that you can emote with. Inside the tool is a ScreenGui, with a script and other frames and buttons. I've managed to make the emotes work when clicking on a specific buton but, you can still unequip the tool while playing an emote, which breaks everything, this is my pathetic attempt at trying to fix that, and the error I got ๐ญ
I've been looking everywhere for a way to do this but I'm getting desperate, any help is VERY VERY appreciated ๐ฅบ๐๐
My line of code: game.Players.LocalPlayer.PlayerGui:WaitForChild("PhoneGui").Phone.HideFrame.Frame.Texting.Emote:Stop()
The error: "Stop is not a valid member of Animation "Players.boyngt6355.PlayerGui.PhoneGui.Phone.HideFrame.Frame.Texting.Emote""
#SOLVED ๐ Hi, this is me begging anyone for help with my tool/gui/anim issue๐ญ๐ญ๐ฅบ
1 messages ยท Page 1 of 1 (latest)
ye so u can watch a youtube video
I don't even know what to search for ๐ญ
I've already tried that many times and got nothing
it's been days since I've made any progress and I'm just getting even more unmotivated each day when I make no new progress
ill assume you got the script from somewhere and u dont know how to use it
look in the script for something like
"local animation = humanoid.Animator:LoadAnimation(game.Players.LocalPlayer.PlayerGui:WaitForChild("PhoneGui").Phone.HideFrame.Frame.Texting.Emote)"
and replace the error line with "animation:Stop()"
I only got a part from a tutorial cuz I had no idea how to make guis pop up when a tool is equipped, and I slightly edited it
I'll just send both scripts to not cause confiusion
if you cant toggle ui visibility with scripts then ur not even over the scripting basics
also thank you so much for responding
alright ill see what i can do
yeah I'm like very at the beginner beginner
** You are now Level 1! **
thank you ๐ญ๐ญ
So, this is the one that moves the gui to player's local gui folder local Ui = script:WaitForChild("PhoneGui")
script.Parent.Equipped:Connect(function()
local ScreenGui = Ui:Clone()
ScreenGui.Parent = game.Players.LocalPlayer.PlayerGui
end)
script.Parent.Unequipped:Connect(function()
game.Players.LocalPlayer.PlayerGui:WaitForChild("PhoneGui").Phone.HideFrame.Frame.Texting.Emote:Stop()
game.Players.LocalPlayer.PlayerGui:FindFirstChild(Ui.Name):Destroy()
end)
and this is the one inside the text buttons that triggers the anims local player = game.Players.LocalPlayer
local character = player.Character
repeat wait()
character = player.Character
until character
local hum = character:WaitForChild("Humanoid")
local Emote = hum:LoadAnimation(script.Parent.Emote)
local frame = script.Parent.Parent
local talk = frame.Talking
local play = frame.Playing
playing = false
script.Parent.MouseButton1Click:Connect(function()
if playing == false then
Emote:Play()
talk.Visible = false
play.Visible = false
playing = true
elseif playing == true then
Emote:Stop()
talk.Visible = true
play.Visible = true
playing = false
end
end)
๐ญ
I mean I can do that (unless I've already forgotten since I've did some scripting lessons ages ago), I just had no diea how to open a gui with a tool
lemme
ok it sucks badly
yeah... I kinda expected it to be unheard levels of garbage ๐จ
how to script a gui
you shouldnt use a toturial and copy the scripts
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local hum = character:WaitForChild("Humanoid")
local Emote = hum:LoadAnimation(script.Parent.Emote)
local frame = script.Parent.Parent
local talk = frame.Talking
local play = frame.Playing
playing = false
script.Parent.MouseButton1Click:Connect(function()
if playing == false then
Emote:Play()
talk.Visible = false
play.Visible = false
playing = true
elseif playing == true then
Emote:Stop()
talk.Visible = true
play.Visible = true
playing = false
end
end)
local tool = script:FindFirstAncestorWhichIsA("Tool")
tool.Unequipped:Connect(function()
Emote:Stop()
tool:FindFirstChildWhichIsA("ScreenGui",true):Destroy()
end)```
replace the second script with this ^
and
local Ui = script:WaitForChild("PhoneGui")
script.Parent.Equipped:Connect(function()
local ScreenGui = Ui:Clone()
ScreenGui.Parent = game.Players.LocalPlayer.PlayerGui
end)
the first with this^
keep in mind tho that these are just corrections
i wouldnt make it this way
yeah, I always follow along and try to learn as much as I can, I just don't have much time to learn everything by watching long series bc of my situation I'm in irl rn, there's a lot going on
okay, thank you so much ๐ญ
I'll test it out in a sec
like I cannot express how greatfull I'm ๐ญ
just test dod
oki
I got this error: Players.boyngt6355.Backpack.Phone.LocalScript.PhoneGui.Phone.HideFrame.Frame.Texting.LocalScript:26: attempt to index nil with 'Unequipped'
where is the tool?
it's originally in a folder in ReplicatedStorage, and when equipped in a gui, it's in the player's inventory
oh only the ui is getting cloned..
oop forgot to click the respond ๐ญ
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local tool = character:FindFirstChildWhichIsA("Tool")
local hum = character:WaitForChild("Humanoid")
local Emote = hum:LoadAnimation(script.Parent.Emote)
local frame = script.Parent.Parent
local talk = frame.Talking
local play = frame.Playing
playing = false
script.Parent.MouseButton1Click:Connect(function()
if playing == false then
Emote:Play()
talk.Visible = false
play.Visible = false
playing = true
elseif playing == true then
Emote:Stop()
talk.Visible = true
play.Visible = true
playing = false
end
end)
tool.Unequipped:Connect(function()
Emote:Stop()
tool:FindFirstChildWhichIsA("ScreenGui",true):Destroy()
end)
replace second script with this instead
okay
oki
** You are now Level 2! **
there's 2 errors this time
this is the first one that appears when I get the tool in the inventory: Players.boyngt6355.Backpack.Phone.LocalScript.PhoneGui.Phone.HideFrame.Frame.Texting.LocalScript:26: attempt to index nil with 'Unequipped'
and this is the second one after unequipping the phone: Players.boyngt6355.Backpack.Phone.LocalScript.PhoneGui.Phone.HideFrame.Frame.Texting.LocalScript:28: attempt to index nil with 'Destroy'
and again thank you so much for the work you're putting into helping me ๐ญ
yikes
ye watch a youtube video
I have no idea what's with this error since it doesn't actually change anything? it's only the second one that does not delete the gui that's kinda an issue since it does not delete the phone gui ๐จ
i hate patching
try this ```lua
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local tool = nil
while not tool do
tool = character:FindFirstChildWhichIsA("Tool")
task.wait(1)
end
local hum = character:WaitForChild("Humanoid")
local Emote = hum:LoadAnimation(script.Parent.Emote)
local frame = script.Parent.Parent
local talk = frame.Talking
local play = frame.Playing
playing = false
script.Parent.MouseButton1Click:Connect(function()
if playing == false then
Emote:Play()
talk.Visible = false
play.Visible = false
playing = true
elseif playing == true then
Emote:Stop()
talk.Visible = true
play.Visible = true
playing = false
end
end)
tool.Unequipped:Connect(function()
Emote:Stop()
tool:FindFirstChildWhichIsA("ScreenGui",true):Destroy()
end)
I did start a series about scripting but I'm too busy to continue it right now, it's like a 120 videos long ๐จ
replace second script still
okay
good then youll learn to script
u probly gona say : "nothing happens now"
okay, so the first error thing is gone completly now but for some reason the gui still does not delete itself (this is the error): Players.boyngt6355.Backpack.Phone.LocalScript.PhoneGui.Phone.HideFrame.Frame.Texting.LocalScript:32: attempt to index nil with 'Destroy'
thankfully no ๐จ๐จ๐ญ๐ญ๐จ
yes, that works ๐
okay
and it stops it when the phone is unequipped
yeah ๐ญ
lemme then
yea, I've been wanting to learn how to do advanced stuff for years now, I just haven't had that much time lately
brawl dev is nice
yeah
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local tool = nil
while not tool do
tool = character:FindFirstChildWhichIsA("Tool")
task.wait(1)
end
local hum = character:WaitForChild("Humanoid")
local Emote = hum:LoadAnimation(script.Parent.Emote)
local frame = script.Parent.Parent
local talk = frame.Talking
local play = frame.Playing
playing = false
script.Parent.MouseButton1Click:Connect(function()
if playing == false then
Emote:Play()
talk.Visible = false
play.Visible = false
playing = true
elseif playing == true then
Emote:Stop()
talk.Visible = true
play.Visible = true
playing = false
end
end)
tool.Unequipped:Connect(function()
Emote:Stop()
script:FindFirstAncestorWhichIsA("ScreenGui"):Destroy()
end)```
I'm currently doing his advanced series
๐จ
so, there's no error in the output this time but
when the phone is equipped the gui does not appear again
Maybe there was some error with the cloning of the gui??
so ur saying that it only works once
yeah๐
brawl dev probably has a gui series
yeah he does, I just haven't started it since I haven't gotten to an episode that he says to start it on
brb
oki
** You are now Level 3! **
I'll look thought the script maybe I can find the reason why it's breaking?? I doubt I'll find anything but I'll try to be usefull ๐ญ
Maybe instead of the gui getting destroyed, it should go invisible?
wait nvm, it's the first script that clones the gui is probably the issue
back back
for some reason, the gui inside the tool gets deleted with the one in PlayerGui
alr gota debug idk whats happening to the tool
fr?
yeah, I checked in the explorer tab while testing
hmm
and when unequipped
oof
alr so
test again but
once you click the emote button
check if the UI is still in the tool
the tool will be inside the character before unequiping
okay
oh right I forgot ๐
it does
its still there after you clicked the emote ui?
yeah
and unequiping destroys it huh
honestly
just put the PhoneGui in a folder in replicated storage
then
change the first script to this:
local Ui = game.ReplicatedStorage.ToolsUis:WaitForChild("PhoneGui")
script.Parent.Equipped:Connect(function()
local ScreenGui = Ui:Clone()
ScreenGui.Parent = game.Players.LocalPlayer.PlayerGui
end)
(name the folder in replicated storage to "ToolsUis"
okay ๐จ
omg it works ๐ญ
I mean
there's 1 issue
you have to double click the emote button twice after unequipping the tool with the emote playing
for some reason this happens with my settings gui too so I have no idea what's going on
yeah ๐ญ๐ญ๐
like I have a tools gui that pops up and if you force quit the settings menu without clicking out of the tools gui, the next time you open the settings you gotta double ckick to make it pop up and then it's like nothing happened
but before that
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local tool = nil
while not tool do
tool = character:FindFirstChildWhichIsA("Tool")
task.wait(1)
end
local hum = character:WaitForChild("Humanoid")
local Emote = hum:LoadAnimation(script.Parent.Emote)
local frame = script.Parent.Parent
local talk = frame.Talking
local play = frame.Playing
playing = false
script.Parent.MouseButton1Click:Connect(function()
if playing == false then
Emote:Play()
talk.Visible = false
play.Visible = false
playing = true
elseif playing == true then
Emote:Stop()
talk.Visible = true
play.Visible = true
playing = false
end
end)
tool.Unequipped:Connect(function()
Emote:Stop()
talk.Visible = true
play.Visible = true
playing = false
script:FindFirstAncestorWhichIsA("ScreenGui"):Destroy()
end)
^second script replace
oki
yeah i guess force quiting the gui is not reseting the bool variables
oh wait
the falsescript is underlined
yeah, I tried testing with the print command and for some reason the bool value would not change
oh oki
okay so, you actually have double click to use an emote each time you equip the tool and not only when you unequip the tool while emoting
I feel like this game is cursed with the double click virus
after the first force unequip is that?
no, it happens each time I equip the tool, even if it's the first
the whole game
....
I would ignore this tho cuz this might be just an issue with my mouse
** You are now Level 4! **
I tested it a few times again
it needs 1 click to emote the first time
but if you unequip it's 2 clicks
so the double click thing must be from unequipping the tool
unequiping the tool is destroying the script
thus reseting it
so it should work as if its the first time
unless..
honestly no idea
lets do some prints
maybe it's changing things in the original inside the replicated storage?
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local tool = nil
while not tool do
tool = character:FindFirstChildWhichIsA("Tool")
task.wait(1)
end
local hum = character:WaitForChild("Humanoid")
local Emote = hum:LoadAnimation(script.Parent.Emote)
local frame = script.Parent.Parent
local talk = frame.Talking
local play = frame.Playing
playing = false
script.Parent.MouseButton1Click:Connect(function()
print(playing,Emote)
if playing == false then
print("Playing")
Emote:Play()
talk.Visible = false
play.Visible = false
playing = true
elseif playing == true then
print("Stopping")
Emote:Stop()
talk.Visible = true
play.Visible = true
playing = false
end
end)
tool.Unequipped:Connect(function()
Emote:Stop()
talk.Visible = true
play.Visible = true
playing = false
script:FindFirstAncestorWhichIsA("ScreenGui"):Destroy()
end)
absolutley no idea how that would work but that's my only idea
its just a copy, not really related
yeah, right
try this
and study the output
also on the first click it does not print anything
yeah ๐ญ
I added the previous script without the prints to the second emote and it works fine
i think..
then
wwwwait
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local tool = nil
while not tool do
tool = character:FindFirstChildWhichIsA("Tool")
task.wait()
end
local hum = character:WaitForChild("Humanoid")
local Emote = hum:LoadAnimation(script.Parent.Emote)
local frame = script.Parent.Parent
local talk = frame.Talking
local play = frame.Playing
playing = false
script.Parent.MouseButton1Click:Connect(function()
print(playing,Emote)
if playing == false then
print("Playing")
Emote:Play()
talk.Visible = false
play.Visible = false
playing = true
elseif playing == true then
print("Stopping")
Emote:Stop()
talk.Visible = true
play.Visible = true
playing = false
end
end)
tool.Unequipped:Connect(function()
Emote:Stop()
talk.Visible = true
play.Visible = true
playing = false
script:FindFirstAncestorWhichIsA("ScreenGui"):Destroy()
end)
go
how did you fix it?
oh
alr so for the emote
I was hoping that it's a simple line of code that I could also add to my other scripts to remove the double click there too lol
how is it breaking again?
not that simple it depends
it breaks after unequipping the tool while using the emote
what kind of breaking
it just keeps playing
like it never plays again?
ah
we did Emote:Stop() havent we
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local tool = nil
while not tool do
tool = character:FindFirstChildWhichIsA("Tool")
task.wait()
end
local hum = character:WaitForChild("Humanoid")
local Emote = hum:LoadAnimation(script.Parent.Emote)
local frame = script.Parent.Parent
local talk = frame.Talking
local play = frame.Playing
playing = false
script.Parent.MouseButton1Click:Connect(function()
if playing == false then
Emote:Play()
talk.Visible = false
play.Visible = false
playing = true
elseif playing == true then
Emote:Stop()
talk.Visible = true
play.Visible = true
playing = false
end
end)
tool.Unequipped:Connect(function()
Emote:Stop()
talk.Visible = true
play.Visible = true
playing = false
task.wait()
print("stopped at unequip")
script:FindFirstAncestorWhichIsA("ScreenGui"):Destroy()
end)
tell me if it prints
hmm
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local tool = nil
while not tool do
tool = character:FindFirstChildWhichIsA("Tool")
task.wait()
end
local hum = character:WaitForChild("Humanoid")
local Emote = hum:LoadAnimation(script.Parent.Emote)
local frame = script.Parent.Parent
local talk = frame.Talking
local play = frame.Playing
playing = false
script.Parent.MouseButton1Click:Connect(function()
if playing == false then
Emote:Play()
talk.Visible = false
play.Visible = false
playing = true
elseif playing == true then
Emote:Stop()
talk.Visible = true
play.Visible = true
playing = false
end
end)
print(tool)
tool.Unequipped:Connect(function()
Emote:Stop()
talk.Visible = true
play.Visible = true
playing = false
task.wait()
print("stopped at unequip")
script:FindFirstAncestorWhichIsA("ScreenGui"):Destroy()
end)
again
the Phone printed but the second one didn't
so after you unequip, nothing is printed right?
yeah
yikes
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local tool = nil
while not tool do
tool = character:FindFirstChildWhichIsA("Tool")
task.wait()
end
local hum = character:WaitForChild("Humanoid")
local Emote = hum:LoadAnimation(script.Parent.Emote)
local frame = script.Parent.Parent
local talk = frame.Talking
local play = frame.Playing
playing = false
script.Parent.MouseButton1Click:Connect(function()
if playing == false then
Emote:Play()
talk.Visible = false
play.Visible = false
playing = true
elseif playing == true then
Emote:Stop()
talk.Visible = true
play.Visible = true
playing = false
end
end)
print(tool)
tool.Unequipped:Connect(function()
print(1)
Emote:Stop()
print(2)
talk.Visible = true
play.Visible = true
playing = false
task.wait()
print("stopped at unequip")
script:FindFirstAncestorWhichIsA("ScreenGui"):Destroy()
end)
again
still only the first one
wait a second
I have an idea
um???
so
I went to the second emote since it has an older script that had only the double click issue
and I copied it for the first emote
just changed the time thing that was breaking the older script
the second emote fully works
but the first one that has the same script as the second one is still broken in the same way
like the only thing that's diffrent between emote 1 and emote 2 is the animation id that's not even inside the script
** You are now Level 5! **
so you copied this
and replaced the second emote script with it
correct?
no, I went back to this one and changed the task.wait to 0, it worked on the second emote, but not of the first one
you mean the second emote works fine
does it have the same script as the first
alr so
the first emote aint stopping you say
even if you click on the button instead of just unequiping
right?
is the second emote printing all the stuff?
it does stop, just not when unequiping
since it's the older version it does not have any prints yet, wait a sec, I'll add them
wait a sec I'll just send the script that's in both
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local tool = nil
while not tool do
tool = character:FindFirstChildWhichIsA("Tool")
task.wait()
end
local hum = character:WaitForChild("Humanoid")
local Emote = hum:LoadAnimation(script.Parent.Emote)
local frame = script.Parent.Parent
local talk = frame.Texting
local play = frame.Playing
playing = false
script.Parent.MouseButton1Click:Connect(function()
if playing == false then
Emote:Play()
talk.Visible = false
play.Visible = false
playing = true
elseif playing == true then
Emote:Stop()
talk.Visible = true
play.Visible = true
playing = false
end
end)
tool.Unequipped:Connect(function()
Emote:Stop()
talk.Visible = true
play.Visible = true
playing = false script:FindFirstAncestorWhichIsA("ScreenGui"):Destroy()
end)
it's this one
sorry for the confiusion ๐ญ
humm
there is not much difference
does the wait at the unequipped event matter
i dont think so
something is off
the tool aint nil
why isnt the first emote firing at the unequiped event
are you sure it is not printing
I put the print in many places to see where it breaks but so far it printed everything with no problems at all
except?
I put prints in 2 places and this is what happened when I unequipped the tool while emoting
my issue is with what comes after the "tool.Unequipped:Connect()"
there were no print issues there
which one did you mean here
print(tool)
..
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local tool = nil
while not tool do
tool = character:FindFirstChildWhichIsA("Tool")
task.wait()
end
local hum = character:WaitForChild("Humanoid")
local Emote = hum:LoadAnimation(script.Parent.Emote)
local frame = script.Parent.Parent
local talk = frame.Talking
local play = frame.Playing
playing = false
script.Parent.MouseButton1Click:Connect(function()
if playing == false then
Emote:Play()
talk.Visible = false
play.Visible = false
playing = true
elseif playing == true then
Emote:Stop()
talk.Visible = true
play.Visible = true
playing = false
end
end)
print(tool)
tool.Unequipped:Connect(function()
print(1)
Emote:Stop()
print(2)
talk.Visible = true
play.Visible = true
playing = false
task.wait()
print("stopped at unequip")
script:FindFirstAncestorWhichIsA("ScreenGui"):Destroy()
end)
do this again
and send the output
first emote right?
where did the stopped and not stopped prints come from tho
I have no idea, I didn't add any there
click them they must redirect u to the script
I tried the second emote
do it before stopping the game
copy the script and past it for the first emote
yikes
aparently you confused first emote with the second
copy paste this into both emotes
yeah they are the same
it isnt printing what it should though
just go copy paste again
I have no idea what's going on since there were no changes in the script but now it works?
there must have been some missed details
I have NO idea what happened
yeah maybe?
welp good that now it works
im pretty sure you were confusing which script for which emote
yeah ๐ญ
omg
I'm gagged
you are so good at scripting ๐ญ
I would have never done it alone ๐ญ ๐ญ
wouldnt say that
but glad i helped
girly.... be so fr
no like seriously thank you so much ๐ญ
and sorry for wasting so much of your time ๐ญ
I did not expect for this to be so messy
354 messages ๐ญ
yeah um ๐จ
SOLVED ๐ Hi, this is me begging anyone for help with my tool/gui/anim issue๐ญ๐ญ๐ฅบ
** You are now Level 6! **