So this script is a landmine script. It would launch a player's body up into the air. It works in test mode, but doesn't work in server mode. Error is at line 27.
math.randomseed(tick(1)) touch = true canRemove = {"RightUpperLeg","RightUpperArm","LeftUpperLeg","LeftUpperArm"} function onTouch(PART) if touch then touch = false --Variables-- local char = PART.Parent local humanoid = char:FindFirstChild("Humanoid") --Explosion effect-- local boom = Instance.new("Explosion", script.Parent) boom.Position = script.Parent.Position boom.BlastRadius = 0 boom.BlastPressure = 0 local boomSound = script.Parent:WaitForChild("Boom") boomSound:Play() --Find, and kill player-- if humanoid ~= nil then humanoid.Health = 0 end --Launches player's body into air-- local torso = char:FindFirstChild("UpperTorso") if torso then torso.Velocity = Vector3.new(math.random(-50,50), 250, math.random(-50,50)) torso.RotVelocity = Vector3.new(math.random(-50,50), math.random(-50,50), math.random(-50,50)) else PART.Velocity = Vector3.new(math.random(-50,50), 250, math.random(-50,50)) PART.RotVelocity = Vector3.new(math.random(-50,50), math.random(-50,50), math.random(-50,50)) end if math.random() < 0.60 then for i = 1, 10 do wait() local children = char:GetChildren() local removeJoint = children[math.random(#children)] for _,name in pairs(canRemove) do if removeJoint.Name:match(name) then if removeJoint.Name == name then removeJoint = char:FindFirstChild("RagdollConstraint"..name) end if removeJoint then removeJoint:Destroy() end break end end end else print("No limbs blown off.") end wait(1) touch = true end end script.Parent.Touched:connect(onTouch)
I think I may have figured out your issue.
math.randomseed(tick(1)) touch = true canRemove = {"RightUpperLeg","RightUpperArm","LeftUpperLeg","LeftUpperArm"} function Applyforce(par,vel) local Forc = Instance.new("BodyVelocity") Forc.Parent = par --wait(.1) Forc.Velocity = vel wait(.2) Forc:Destroy() end function onTouch(PART) if touch then touch = false --Variables-- local char = PART.Parent local humanoid = char:FindFirstChild("Humanoid") --Explosion effect-- local boom = Instance.new("Explosion", script.Parent) boom.Position = script.Parent.Position boom.BlastRadius = 0 boom.BlastPressure = 0 local boomSound = script.Parent:WaitForChild("Boom") boomSound:Play() --Find, and kill player-- if humanoid ~= nil then humanoid.Health = 0 end --Launches player's body into air-- local torso = char:FindFirstChild("LowerTorso") for I, v in pairs(char:GetChildren()) do wait() if torso then local apf = coroutine.wrap(Applyforce) --torso.Velocity = Vector3.new(math.random(-50,50), 250, math.random(-50,50)) --[[apf(torso, Vector3.new(math.random(-50,50), 250, math.random(-50,50))) torso.RotVelocity = Vector3.new(math.random(-50,50), math.random(-50,50), math.random(-50,50)) else PART.Velocity = Vector3.new(math.random(-50,50), 250, math.random(-50,50)) PART.RotVelocity = Vector3.new(math.random(-50,50), math.random(-50,50), math.random(-50,50))]] if v:IsA("Part") or v:IsA("MeshPart") then apf(v,Vector3.new(math.random(-50,50), 250, math.random(-50,50))) end end end if math.random() < 0.60 then for i = 1, 10 do wait() local children = char:GetChildren() local removeJoint = children[math.random(#children)] for _,name in pairs(canRemove) do if removeJoint.Name:match(name) then if removeJoint.Name == name then removeJoint = char:FindFirstChild("RagdollConstraint"..name) end if removeJoint then removeJoint:Destroy() end break end end end else print("No limbs blown off.") end wait(1) touch = true end end script.Parent.Touched:connect(onTouch)
I tested this in a game and I figured out the issue is velocity itself and server latency. So I decided to make a coroutine using body velocity. And the result seemed to have worked in server.
Comment back if it works the way you want it to.