anyone knows how to fix this or suggest better alternatives for the scripts?
local player = game:GetService("Players").LocalPlayer
local RS = game:GetService("ReplicatedStorage")
local SS = game:GetService("ServerStorage")
local ragdollevent = RS:WaitForChild("RagdollPlayer")
local newblocks = SS:WaitForChild("ThrowingBlocks"):GetChildren()
local throwevent = RS:WaitForChild("ThrownBlock")
local newblock
throwevent.OnServerEvent:Connect(function(player: Player ,holdingblockpos: Part, force, mousehit: Vector3)
if holdingblockpos.Parent == "GreenCube" and holdingblockpos.Parent:IsA("Tool") then
newblock = newblocks[1]:Clone()
elseif holdingblockpos.Parent == "BlueCube" and holdingblockpos.Parent:IsA("Tool") then
newblock = newblocks[2]:Clone()
elseif holdingblockpos.Parent == "RedCube" and holdingblockpos.Parent:IsA("Tool") then
newblock = newblocks[3]:Clone()
end
newblock.Parent = workspace
newblock.Position = holdingblockpos.Position + Vector3.new(0, 1, 1)
newblock:ApplyImpulse(mousehit * force)
end)
few mistake here n there mb