-
What do you want to achieve? I’m trying to make a GUI show up when an event is fired if you’re on a team.
-
What is the issue? I don’t get any errors, so I’m unsure asto what’s wrong here.
-
What solutions have you tried so far? I’ve searched it up on the DevForum but have found nothing that has helped me in this situation.
Script firing the event
local Part = script.Parent
local ClickDetector = Part.ClickDetector
local MoneySpawner = Part.Parent.Parent.MoneySpawnerPoint
local Money = game.ServerStorage.Money
local Event = game.ReplicatedStorage.ATMRobEvent
local AlreadyRobbed = false
function onClick(player)
if Part.BrickColor == BrickColor.new("Lime green") and AlreadyRobbed == false then
Part.BrickColor = BrickColor.new("Really red")
AlreadyRobbed = true
for count = 1,3 do
MoneyClone = Money:Clone()
MoneyClone.Parent = game.Workspace
MoneyClone.CFrame = MoneySpawner.CFrame
end
Event:Fire(player.Name)
script.Parent.Parent.Sound:Play()
end
if Part.BrickColor == BrickColor.new("Really red") and AlreadyRobbed == true then
wait(30)
AlreadyRobbed = false
Part.BrickColor = BrickColor.new("Lime green")
end
end
ClickDetector.MouseClick:Connect(onClick)
Script receiving the event
local Event = game.ReplicatedStorage.ATMRobEvent
local Player = game.Players.LocalPlayer
function onEventPlayed()
print("Working 1")
if Player.Team == game.Teams["Patrol Unit"] then
print("Working 2")
script.Parent.Visible = true
end
end
Event.Event:Connect(onEventPlayed)
^ This is a Local Script