I am having an issue with a script I made (PlayerGUI) which involves making the gui visible, it works fine in studio but not in -game. Here is the error which I get.
local goal1 = workspace.goal1
local goal2 = workspace.goal2
local ball = workspace.TPS
local player = game.Players.LocalPlayer
local ball = game.Workspace.TPS
local team = game.Teams
ball.Touched:Connect(function(part)
if part == goal1 and player.Team == game.Teams.Scousers then
game:GetService('StarterGui'):SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
player.PlayerGui.EmotesGUI["Open/Close"].Visible = true
player.PlayerGui.Start.Menu.Visible = false
wait (10)
player.PlayerGui.EmotesGUI.Animations.Visible = false
player.PlayerGui.EmotesGUI.Animations.Visible = false
player.PlayerGui.Start.Menu.Visible = true
player.PlayerGui.EmotesGUI["Open/Close"].Visible = false
game:GetService('StarterGui'):SetCoreGuiEnabled(Enum.CoreGuiType.All, true)
elseif part == goal2 and player.Team == game.Teams["Les Parisiens"] then
game:GetService('StarterGui'):SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
player.PlayerGui.EmotesGUI["Open/Close"].Visible = true
player.PlayerGui.EmotesGUI.Animations.Visible = true
player.PlayerGui.Start.Menu.Visible = false
wait (10)
player.PlayerGui.EmotesGUI.Animations.Visible = false
player.PlayerGui.EmotesGUI.Animations.Visible = false
player.PlayerGui.Start.Menu.Visible = true
player.PlayerGui.EmotesGUI["Open/Close"].Visible = false
game:GetService('StarterGui'):SetCoreGuiEnabled(Enum.CoreGuiType.All, true)
end
end)
EDIT: This script that I made works in game as well.
local goal1 = workspace.goal1
local goal2 = workspace.goal2
local ball = workspace.TPS
local player = game.Players.LocalPlayer
local ball = game.Workspace.TPS
local team = game.Teams
ball.Touched:Connect(function(part)
if part == goal1 then
game.ReplicatedStorage.LiverpoolParticles:Clone().Parent = workspace
game.ReplicatedStorage.RedsBubbles:Clone().Parent = workspace
wait (10)
workspace.LiverpoolParticles:Destroy()
game.Workspace.RedsBubbles:Destroy()
elseif part == goal2 then
game.ReplicatedStorage.ParisParticles:Clone().Parent = workspace
game.ReplicatedStorage.ParisBubbles:Clone().Parent = workspace
wait (10)
workspace.ParisParticles:Destroy()
game.Workspace.ParisBubbles:Destroy()
end
end)