Hi. I am new to using CFrame and have made a script that shows the billboard gui where the player is.
The only problem is, it shows the billboard GUI to only the player that pressed the button “Q” and I want it to be visible to everyone. (the script I made is inside a tool)
Would I make it visible by firing a remote event?
The billboard GUI is located in lighting and here is what is inside it
Here is the script:
local TM = require(script.Parent.Parent:WaitForChild("ToolManagment"))
local QDown = false
local Tween = require(script.Parent.Parent:WaitForChild("Module_Management"):WaitForChild("Tweening"))
local Mouse = game.Players.LocalPlayer:GetMouse()
local Direction = Enum.EasingDirection.Out
local Style = Enum.EasingStyle.Back
local Duration = 0.2
local CFRAME_HERE_1 = CFrame.new(1.8,0.4,-0.3) * CFrame.fromEulerAnglesXYZ(math.pi/0.41,-0.2,1)
local CFRAME_HERE_2 = CFrame.new(-1.8,0.4,-0.3) * CFrame.fromEulerAnglesXYZ(math.pi/0.41,0.2,-1)
local function Marker(Position, Target)
if Target == nil or Target:FindFirstAncestor("Ignore") then
return
end
game.ReplicatedStorage.Marker:FireServer(Position)
for i, v in pairs(workspace.Markers:GetChildren()) do
if v.Name == game.Players.LocalPlayer.Name then
v:Destroy()
end
end
local FakeColor = Instance.new("Part", game.ReplicatedStorage)
FakeColor.BrickColor = game.Players.LocalPlayer.TeamColor
local Color = FakeColor.Color
local Marker = game.Lighting.Marker:Clone()
Marker.Parent = workspace.Markers
Marker.Marker.Icon.ImageColor3 = Color
Marker.Marker.Label.Text = game.Players.LocalPlayer.Name
Marker.Marker.Label.TextColor3 = Color
Marker.Name = game.Players.LocalPlayer.Name
Marker.Position = Position
game.Debris:AddItem(Marker, 3)
game.Debris:AddItem(FakeColor, 0)
end
script.Parent.Equipped:Connect(function (mouse)
mouse.KeyDown:Connect(function (key)
key = key:lower()
if key == "q" then
if QDown == false then
QDown = true
Tween.TweenWeld("Right Arm", CFrame.new(1.5,0,0), CFRAME_HERE_1, Direction, Style, Duration)
Marker(Mouse.Hit.p, Mouse.Target)
wait(0.7)
TM.ResetWelds()
QDown = false
end
end
end)
end)
Any help would be appreciated, thanks!
You are trying to detect a User input, so you won’t be able to do it directly from the Server.
Therefore, through a LocalScript, just fire a Remote Event that will disable/enable the Billboard once Q is pressed.
so how would i disable the billboard by firing a remote event?
You can fire RemoteEvent X, and pass an argument like ‘toEnable’
function ServerEvent(player, toEnable)
[...].Enabled = toEnable
end
Since this is a local script it’ll only show to the client, to have it reflect across the entire server to each client you’ll need to make use of a RemoteEvent.
local TM = require(script.Parent.Parent:WaitForChild("ToolManagment"))
local QDown = false
local Tween = require(script.Parent.Parent:WaitForChild("Module_Management"):WaitForChild("Tweening")) --move to server script
local Mouse = game.Players.LocalPlayer:GetMouse()
--[[local Direction = Enum.EasingDirection.Out
local Style = Enum.EasingStyle.Back
local Duration = 0.2
local CFRAME_HERE_1 = CFrame.new(1.8,0.4,-0.3) * CFrame.fromEulerAnglesXYZ(math.pi/0.41,-0.2,1)
local CFRAME_HERE_2 = CFrame.new(-1.8,0.4,-0.3) * CFrame.fromEulerAnglesXYZ(math.pi/0.41,0.2,-1)--]] --these variables will be required in the server script
local function Marker(Position, Target)
if Target == nil or Target:FindFirstAncestor("Ignore") then
return
end
game.ReplicatedStorage.Marker:FireServer(Position)
for i, v in pairs(workspace.Markers:GetChildren()) do
if v.Name == game.Players.LocalPlayer.Name then
v:Destroy()
end
end
--[[
local FakeColor = Instance.new("Part", game.ReplicatedStorage)
FakeColor.BrickColor = game.Players.LocalPlayer.TeamColor
local Color = FakeColor.Color
local Marker = game.Lighting.Marker:Clone()
Marker.Parent = workspace.Markers
Marker.Marker.Icon.ImageColor3 = Color
Marker.Marker.Label.Text = game.Players.LocalPlayer.Name
Marker.Marker.Label.TextColor3 = Color
Marker.Name = game.Players.LocalPlayer.Name
Marker.Position = Position
game.Debris:AddItem(Marker, 3)
game.Debris:AddItem(FakeColor, 0)
end--]] --move all this ui handling to the server script
script.Parent.Equipped:Connect(function (mouse)
mouse.KeyDown:Connect(function (key)
key = key:lower()
if key == "q" then
if QDown == false then
--fire the server here and perform the animation/surface gui showing in the server script
QDown = true
--[[Tween.TweenWeld("Right Arm", CFrame.new(1.5,0,0), CFRAME_HERE_1, Direction, Style, Duration)
Marker(Mouse.Hit.p, Mouse.Target)
wait(0.7)
TM.ResetWelds()--]] --move this animation code to the server script
QDown = false
end
end
end)
end)
I’ve edited out blocks of code which will need to be moved to a server script, I’ve also added a comment showing where the 2nd FireServer() should take place, good luck.
this is what i put in the server script
local TM = require(script.Parent.Parent:WaitForChild("ToolManagment"))
local QDown = false
local Tween = require(script.Parent.Parent:WaitForChild("Module_Management"):WaitForChild("Tweening")) --move to server script
local Mouse = game.Players.LocalPlayer:GetMouse()
local Direction = Enum.EasingDirection.Out
local Style = Enum.EasingStyle.Back
local Duration = 0.2
local CFRAME_HERE_1 = CFrame.new(1.8,0.4,-0.3) * CFrame.fromEulerAnglesXYZ(math.pi/0.41,-0.2,1)
local CFRAME_HERE_2 = CFrame.new(-1.8,0.4,-0.3) * CFrame.fromEulerAnglesXYZ(math.pi/0.41,0.2,-1)
local FakeColor = Instance.new("Part", game.ReplicatedStorage)
FakeColor.BrickColor = game.Players.LocalPlayer.TeamColor
local Color = FakeColor.Color
local Marker = game.Lighting.Marker:Clone()
Marker.Parent = workspace.Markers
Marker.Marker.Icon.ImageColor3 = Color
Marker.Marker.Label.Text = game.Players.LocalPlayer.Name
Marker.Marker.Label.TextColor3 = Color
Marker.Name = game.Players.LocalPlayer.Name
Marker.Position = Position
game.Debris:AddItem(Marker, 3)
game.Debris:AddItem(FakeColor, 0)
Tween.TweenWeld("Right Arm", CFrame.new(1.5,0,0), CFRAME_HERE_1, Direction, Style, Duration)
Marker(Mouse.Hit.p, Mouse.Target)
wait(0.7)
TM.ResetWelds()