I am trying to make a GUI button that makes users explode when clicked. The explosions do not happen at the position of the player, but at 0,0,0. How do I fix this?
Here is the local script within the GUI button:
local RS = game.ReplicatedStorage local explosionEvent = RS.Explosion script.Parent.MouseButton1Click:Connect(function () local plrPosition = game.Players.LocalPlayer.Character:WaitForChild("HumanoidRootPart").Position explosionEvent:FireServer(plrPosition) end)
Here is the server script within ServerScriptService:
local RS = game.ReplicatedStorage local explosionEvent = RS.Explosion explosionEvent.OnServerEvent:Connect(function(player, plrPosition) print(plrPosition) local explosion = Instance.new("Explosion", game.Workspace) explosion.Position = Vector3.new(plrPosition) explosion.BlastRadius = 10 explosion.DestroyJointRadiusPercent = 0 end)
You dont need the Vector3.new() because plrPosition already has a Vector3 value.
explosion.Position = plrPosition