The issue is that it’s only returning “Unable to cast value to Objects” and not creating a union.
I couldn’t find anybody else who had this issue with unions/
LOCAL SCRIPT:
local player = game.Players.LocalPlayer
local RS = game.ReplicatedStorage
local mouse = player:GetMouse()
mouse.Button1Down:Connect(function()
local loc = mouse.Hit.Position
RS.Pos:FireServer(loc)
end)
SERVER SCRIPT:
local RS = game.ReplicatedStorage
local part = game.Workspace.Part
local function pos(player, loc)
local bull = RS.Bullet:Clone()
bull.Parent = workspace.Parts
bull.Position = loc
wait(00001)
local union = part:SubtractAsync(bull)
union.Parent = workspace
end
RS.Pos.OnServerEvent:Connect(pos)
local RS = game.ReplicatedStorage
local part = game.Workspace.Part
local function pos(player, loc)
local bull = RS.Bullet:Clone()
bull.Parent = workspace.Parts
bull.Position = loc
local Parts = {bull}
wait(00001)
local union = part:SubtractAsync(Parts)
union.Parent = workspace
end
RS.Pos.OnServerEvent:Connect(pos)
When I see Async I always think it deals with an array so maybe this?
--//Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")
--//Variables
local part = workspace.Part
--//Functions
ReplicatedStorage.Pos.OnServerEvent:Connect(function(player, position)
if not position or typeof(position) ~= "Vector3" then
return
end
local bull = ReplicatedStorage.Bullet:Clone()
bull.Position = position
bull.Parent = workspace.Parts
local union = part:SubtractAsync({bull})
union.Parent = workspace
end)
I also added some sanity checks so the script won’t error if an invalid position is sent.