i’m making a hitbox and then trying to send the hitbox to a local script. the localscript can then look if the player has “SeeHitbox” true or false (basically just checking if the player wants to see the hitbox or not). But whenever i try to get the instance from the remote function it’s just nil.
script:
local VisibleHitboxRemote = game.ReplicatedStorage.Remotes.MakeHitboxVis
local function MakeHitBox(player, size, cframe)
local HitBrick = Instance.new("Part")
HitBrick.Parent = game.Workspace
HitBrick.Anchored = true
HitBrick.Transparency = 1
HitBrick.Size = size
HitBrick.CFrame = cframe
HitBrick.Material = Enum.Material.ForceField
HitBrick.Color = Color3.new(1, 0.2, 0.2)
HitBrick.CanCollide = false
VisibleHitboxRemote:FireAllClients(HitBrick)
print(HitBrick)
return HitBrick
end
local script:
wait()
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local Value = character:WaitForChild("Values").SeeHitbox
local event = game.ReplicatedStorage:WaitForChild("Remotes").MakeHitboxVis
event.OnClientEvent:Connect(function(HitBrick)
print(HitBrick)
if Value.Value == true then
HitBrick.Transparency = 0
else
HitBrick.Transparency = 1
end
end)
error message: