--Objects
local Parent = script.Parent
local Prompt = Parent:FindFirstChild("ThrowChairPrompt")
local Chair = Parent.Parent
local BadgeService = game:GetService("BadgeService")
--Values
local IsThrowing = false
local animationId = 12647936621
local Rotation = CFrame.Angles(45,0,0)
local animation = Instance.new("Animation")
animation.AnimationId = 'rbxassetid://' .. animationId
local BadgeId = 2141870924
--Functions
Prompt.Triggered:Connect(function(plr)
if not IsThrowing then
IsThrowing = true
Prompt.Enabled = false
local RightArm = plr.Character:FindFirstChild("Right Arm")
Chair:SetPrimaryPartCFrame(RightArm.CFrame)
for i, z in pairs(Chair:GetChildren()) do
if z:IsA("BasePart") then
z.CanCollide = false
end
end
local Weld = Instance.new("Weld")
Weld.Parent = RightArm
Weld.Part0 = RightArm
Weld.Part1 = Chair.PrimaryPart
local humanoid = plr.Character:FindFirstChild("Humanoid")
local animationTrack = humanoid:WaitForChild("Animator"):LoadAnimation(animation):Play()
wait(0.8)
Weld:Destroy()
local Hum = plr.Character:FindFirstChild("HumanoidRootPart")
script.Parent.CFrame = Hum.CFrame * CFrame.new(0,6,0) * Rotation
local Direction = Hum.CFrame.LookVector
local forceMultipliter = 50 * Parent:GetMass()
Parent:ApplyImpulse(Direction * forceMultipliter)
wait(0.125)
for i, z in pairs(Chair:GetChildren()) do
if z:IsA("BasePart") then
z.CanCollide = true
end
end
local Chance = math.random(1,100)
if Chance == 37 then
wait(2)
local Explosion = Instance.new("Explosion")
Explosion.Parent = Parent
Explosion.Position = Parent.Position
print("What just happend?")
BadgeService:AwardBadge(plr.UserId, BadgeId)
end
IsThrowing = false
Prompt.Enabled = true
end
end)
Interesting, with the documentation thanks for showing me.
Unfortunately testing shows otherwise.
Applying impulse on server on part with serverscript.
local part = script.Parent
--task.spawn(function()
-- while true do
-- local player = game.Players:FindFirstChildOfClass("Player")
-- print(player)
-- if player then
-- part:SetNetworkOwner(player)
-- end
-- task.wait(1)
-- end
--end)
while true do
part:ApplyImpulse(Vector3.yAxis*part:getMass()*100)
task.wait(1)
end
If you set the network owner to client
local part = script.Parent
task.spawn(function()
while true do
local player = game.Players:FindFirstChildOfClass("Player")
print(player)
if player then
print("Setting network owner", player)
part:SetNetworkOwner(player)
end
task.wait(1)
end
end)
while true do
part:ApplyImpulse(Vector3.yAxis*part:getMass()*100)
task.wait(1)
end
It will not jump anymore, once you delete the player instance on the server it will then apply all at once and go to the server. I believe this is what is happening to @BrokenV0id scenario.