Hello! I’m making a gun and I’m making something like a UI that shows how much damage it took. Someone told me to use remote events so I also have to move the data through the arguments. When the arguments are received, though, in the server script, they are all mysteriously converted (Numbers to nil, instances to strings, etc.).
Local script inside gun tool:
local billboard = Instance.new("BillboardGui")
billboard.Parent = game.ServerStorage
local label = Instance.new("TextLabel")
label.Parent = billboard
label.BackgroundTransparency = 1
label.Font = Enum.Font.Oswald
label.TextColor3 = Color3.fromRGB(255, 0, 0)
label.TextSize = 50
label.Visible = true
label.TextStrokeTransparency = 0
local bullets = 5
local reload = false
local config = script.Parent.Configuration
script.Parent.Equipped:Connect(function(mouse)
mouse.Button1Down:Connect(function()
if bullets > 1 then
if reload == false then
local part = mouse.Target
local hum = part.Parent:FindFirstChild("Humanoid")
if hum then
if part.Name == "Head" then
hum.Health -= config.Headshot.Value
game.ReplicatedStorage.GunGUI:FireServer(game.ServerStorage:FindFirstChild("BillboardGui"), game.ServerStorage.BillboardGui:FindFirstChild("TextLabel"), true, 1, 25)
print("HEADSHOT")
bullets -= 1
end
end
end
--Rest of the script
(The rest of the code is reloading)
Server script in server script service:
game.ReplicatedStorage.GunGUI.OnServerEvent:Connect(function(billboard, label, alwaysontop, zindex, text)
local list = {billboard, label, alwaysontop, zindex, text}
for i = 1, #list do
print(typeof(list[i]))
end
print(typeof(label))
billboard.AlwaysOnTop = alwaysontop
label.ZIndex = zindex
label.Text = text
end)
(The typeof was when I was looking at what happened to the code so don’t mind if some parts of the code that should be there (GUI parent) aren’t there)
I’d appreciate it if you’d help me. Thanks.