A couple of days ago I tried making a marked system which when you press a button it will clone a part from ReplicatedStorage with a BillboardGui on it into workspace, I got it to working but I'm struggling with getting it to be visible on a certain team client.
The localscript that fires it
local FakeOrder = game.ReplicatedStorage.Commands.FakeCommand
local Order = game.ReplicatedStorage.Commands.EnemySpot
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("Command")
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local UIS = game:GetService("UserInputService")
local Opened = script.Parent.Parent.Parent.OpenedVal
local Team = script.Parent.Parent.Parent.Parent.Parent.TeamColor
UIS.InputBegan:connect(function(keyCode)
if keyCode.keyCode == Enum.KeyCode.Y then
if Opened.Value == true then
script.Parent.Parent.Parent.Enabled = false
local CloneFakeOrder = FakeOrder:Clone()
CloneFakeOrder.CFrame = CFrame.new(Vector3.new(Mouse.Hit.X, Mouse.Hit.Y, Mouse.Hit.Z))
local position = CloneFakeOrder.Position
remoteEvent:FireServer(Order, position, Team)
script.Parent.Parent.Parent.Sound:Play()
wait(0.1)
Opened.Value = false
print("done")
end
end
end)
script in serverscript
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("Command")
local remoteEvent2 = ReplicatedStorage:WaitForChild("DeleteCommand")
remoteEvent.OnServerEvent:Connect(function(player, Order, position, Team)
local ClonedCommand = Order:clone()
local Command = ClonedCommand.Name
ClonedCommand.Parent = workspace
ClonedCommand.Position = position
local Theam = Team.Name
local ClohnedCommand = ClonedCommand
remoteEvent2:FireAllClients(Theam ,ClohnedCommand)
print("2done")
end)
Another localscript in StarterGui
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("DeleteCommand")
remoteEvent.OnClientEvent:Connect(function(player, Theam ,ClohnedCommand)
if script.Parent.Parent.TeamColor == Theam then
print("3done")
else
ClohnedCommand.BillboardGui:destroy()
print("3done")
end
end)
The error I'm getting is: Players.Player1.PlayerGui.LocalScript:8: attempt to index nil with 'BillboardGui'
Any help would be appreciated
