I have 2 script 1.(game.StarterGui.ScreenGui.Frame.ChickenMan.Script)-change team script
`local player = script.Parent.Parent.Parent.Parent.Parent Frame = script.Parent.Parent local gui = game.StarterGui.ScreenGui.TeleportButton script.Parent.MouseButton1Click:connect(function() gui.Visible = true player.Team = game.Teams:FindFirstChild("ChickenMan") player.Character.Humanoid.Health = 0 Frame.Position = (UDim2.new(0.5,0,-0.5,0)) game.Workspace.Teleport.RemoteFunction:InvokeServer() end)`
2.(game.StarterGui.ScreenGui.TeleportButton.LocalScript)- teleport script
local disabled = false local player = script.Parent.Parent.Parent.Parent script.Parent.MouseButton1Click:connect(function() if disabled == false then disabled = true script.Parent.BackgroundColor3 = Color3.new(217, 0, 0) game.Workspace.Teleport.RemoteFunction:InvokeServer() wait(3) script.Parent.BackgroundColor3 = Color3.new(0, 154, 0) disabled = false end end)
in first TeleportButton.visible = false i want to set TeleportButton.visible = true in script1 but my script isn't work ,what wrong in my script Can you help me,pls thank !this is a photo
What seemed to be the problem is this variable you stored.
local gui = game.StarterGui.ScreenGui.TeleportButton
People tend to do this same kind of mistake, they use the service StarterGui
when it does nothing at all but to only 'serve' (PlayerReplicated
) the players every child of the StarterGui into the players' PlayerGui
. So any GuiObject
inside the StarterGui will be PlayerReplicated
into the Player's PlayerGui
Therefore, your variable should be
local gui = player:WaitForChild("PlayerGui")
he got a point in that but if u want to access the same thing as ur trying to access in ur script then u should change local
gui
=
game.StarterGui.ScreenGui.TeleportButton
to
local gui = game.Players.LocalPlayer:WaitForChild("PlayerGui").ScreenGui.TeleportButton
that will access the local players screen and the exact same part of the screen as u tried to access in ur own script
hey everyone thank for Gameplayer365247v2 and NickAtNick's comment but it can't be use. and i don't good at code so please help me more a lot of thank you???????????? (Gameplayer365247v2 and NickAtNick script when i run it don't have anything happen)