I’m trying to make a beam between a player and a part it doesn’t work even without the warn please help me here’s the code:
--[[local repstorage = game:GetService("ReplicatedStorage")
local player = game:GetService("Players").LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
repstorage.CreateBeam.OnClientEvent:Connect(function(player, deliverypoint)
local attachment1 = Instance.new("Attachment", char.HumanoidRootPart)
local attachment2 = Instance.new("Attachment", workspace:FindFirstChild(deliverypoint.Name))
local beam = Instance.new("Beam", char.HumanoidRootPart)
beam.Attachment0 = attachment1
beam.Attachment1 = attachment2
end)]]
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local function onBeamCreated(deliverypoint)
local character = player.Character or player.CharacterAdded:Wait()
local rootPart = character:WaitForChild("HumanoidRootPart")
local targetPart = workspace:FindFirstChild(deliverypoint)
if targetPart == nil or not targetPart:IsA("BasePart") then
warn("Invalid deliverypoint: ", deliverypoint)
return
end
local attachment1 = Instance.new("Attachment", rootPart)
local attachment2 = Instance.new("Attachment", targetPart)
local beam = Instance.new("Beam", rootPart)
beam.Attachment0 = attachment1
beam.Attachment1 = attachment2
end
ReplicatedStorage.CreateBeam.OnClientEvent:Connect(onBeamCreated)
A proximity prompt fires the client and I know it is running. The commented out code is my past code I don’t wanna delete.
