Hello there,
I’m making my own project and I doing superpower that you can throw the hammer
But when I press E it will play the animation and it will dont do anything, I tried to debug it and it printed all prints in script but in real nothing happens!
My script:
local remotes = game.ReplicatedStorage.ThrowHammerSuperpower
remotes.HaveSuperpower.OnServerInvoke = function(plr)
if plr.ActualPower.Value == "ThrowHammer" then
return true
else
return false
end
end
remotes.Throw.OnServerEvent:Connect(function(plr)
if plr.ActualPower.Value == "ThrowHammer" then
local Load = plr.Character.Humanoid:LoadAnimation(game.ServerStorage.ThrowAnim)
Load:Play()
print("PlayedAnimation")
wait(0.3)
print("Continue Trough Wait")
plr.Character.Hammer.Handle.Transparency = 1
local NewHandle = plr.Character.Hammer.Handle:Clone()
NewHandle.Parent = workspace
NewHandle.CanCollide = true
local Velocity = Instance.new("BodyVelocity",NewHandle)
Velocity.Velocity = plr.Character.HumanoidRootPart.CFrame.lookVector * 50
Velocity.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
print("ThrowedHammer")
local Connection
Connection = NewHandle.Touched:Connect(function(hit)
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
if Player then
print("DetectedPlayer")
local Done = NewHandle.CFrame.lookVector * 40
local Vel = Instance.new("BodyVelocity",Player.Character.HumanoidRootPart)
Vel.Velocity = Done
Vel.MaxForce = Vector3.new(500000,50000,500000)
local Force = Instance.new("BodyForce",Player.Character.HumanoidRootPart)
Force.Force = Vector3.new(50,25,50)
game.Debris:AddItem(Vel,1)
game.Debris:AddItem(Force,1)
Player.Character.HumanoidRootPart.LastHit.Value = plr.Name
plr.Character.Hammer.Handle.Transparency = 0
NewHandle:Destroy()
Connection:Disconnect()
end
end)
print("Connected funcion")
plr.Character.Hammer.Handle.Transparency = 0
NewHandle:Destroy()
Connection:Disconnect()
else
plr:Kick("Cheating")
end
end)
Thanks for any help