Idea: I'm trying to make it so whenever you pull out a weapon, the text at the bottom of the screen shows what weapon it is.
Problem: However, the text doesn't seem to be going visible which really confuses me. I also tried to make the labels change to whatever the string value is, but that didn't seem to work either. I'm a little new to scripting if you couldn't tell.
Thanks (I've highlighted the parts of the script that make the Gui go visible and not visible)
script:
wait(1) local dance = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation) local Player = game.Players.LocalPlayer local Action = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.ACtion) local Speed= 28 local DefaultSpeed= 16 local Fork = game.StarterGui.ScreenGui.TrustyFork -- Text with weapon text local Hands = game.StarterGui.ScreenGui.Hands -- Text with weapon Text local Tool = script.Parent Tool.Equipped:Connect(function() dance:Play() Player.Character.Humanoid.WalkSpeed = Speed Fork.Visible = true -- Visible Part Hands.Visible = false -- Visible Part end) Tool.Unequipped:Connect(function() dance:Stop() Player.Character.Humanoid.WalkSpeed = DefaultSpeed Hands.Visible = true -- Visible Part Fork.Visible = false -- Visible Part end) Tool.Activated:Connect(function() Action:Play() wait(1) dance:Play() end)
You don't change the GUIs from StarterGui. Everything in StarterGui clones into the Player's PlayerGui when they join. To change a player's GUIs, you would access their PlayerGui, which is a child of the player that stores all the players GUIs. You could refer to the objects as:
local player = game.Players.LocalPlayer local trustforky = player.PlayerGui:WaitForChild("ScreenGui").TrustyFork local hands = player.PlayerGui:WaitForChild("ScreenGui").Hands
Your script would be:
wait(1) local Player = game.Players.LocalPlayer local dance = Player.Character.Humanoid:LoadAnimation(script.Parent.Animation) local Action = Player.Character.Humanoid:LoadAnimation(script.Parent.ACtion) local Speed= 28 local DefaultSpeed= 16 local Fork = player.PlayerGui:WaitForChild("ScreenGui").TrustyFork local Hands = player.PlayerGui:WaitForChild("ScreenGui").Hands local Tool = script.Parent Tool.Equipped:Connect(function() dance:Play() Player.Character.Humanoid.WalkSpeed = Speed Fork.Visible = true -- Visible Part Hands.Visible = false -- Visible Part end) Tool.Unequipped:Connect(function() dance:Stop() Player.Character.Humanoid.WalkSpeed = DefaultSpeed Hands.Visible = true -- Visible Part Fork.Visible = false -- Visible Part end) Tool.Activated:Connect(function() Action:Play() wait(1) dance:Play() end)