I have a function in a local script but idk why it’s don’t work and it dosn’t give me error i try put print for debugging and just 1 print show up
here is my script
elseif action == "TelekinesisEnd" then
print("ad")
teleEnabled = false
if targetedModel and targetedModel:FindFirstChild("BodyPosition") then
targetedModel.BodyPosition:Destroy()
end
game.ReplicatedStorage.SetNetworkOwner:FireServer(targetedModel, false)
game.ReplicatedStorage.Telekinesis:FireServer(targetedModel.Parent, false)
targetedModel = nil
end
UIS.InputEnded:Connect(function(input, isTyping)
if isTyping then return end
if input.KeyCode == Enum.KeyCode.T then
ButtonHandler("TelekinesisEnd", input.UserInputState.Name)
print("2")
end
end)
local function ButtonHandler(action, inputState)
if action == "TelePunching" then
if CanUsePower then
local target = mouse.Target
local anim
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:FindFirstChild('Humanoid')
anim = Humanoid.Animator:LoadAnimation(script.TelekinesicPunch)
anim:Play()
wait(0.8)
PowerEvent:FireServer(action, inputState, target, Character.HumanoidRootPart, Character)
end
elseif action == "ExplosivePunching" then
if CanUsePower then
local target = mouse.Target
local anim
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:FindFirstChild('Humanoid')
anim = Humanoid:LoadAnimation(script.TelekinesicPunch)
anim:Play()
wait(0.8)
PowerEvent:FireServer(action, inputState ,target ,Character.HumanoidRootPart, mouse.Hit,Character)
end
elseif action == "AstroProjectBegin" then
local target = mouse.Target
PowerEvent:FireServer(action, inputState ,target ,Character.HumanoidRootPart, mouseHit, Character)
CanUsePower = false
elseif action == "AstroProjectEnd" then
local target = mouse.Target
PowerEvent:FireServer(action, inputState ,target ,Character.HumanoidRootPart, mouseHit, Character)
CanUsePower = true
elseif action == "TelekinesisBegin" then
if CanUsePower then
local camera = workspace.CurrentCamera
local target = mouse.Target
if target and target.Parent:FindFirstChild("Humanoid") then
teleEnabled = true
targetedModel = target.Parent.PrimaryPart
game.ReplicatedStorage.SetNetworkOwner:FireServer(targetedModel, true)
game.ReplicatedStorage.Telekinesis:FireServer(target.Parent, true)
local bp = Instance.new("BodyPosition", targetedModel)
bp.MaxForce = Vector3.new(5e5,5e5,5e5)
bp.Position = Player.Character.HumanoidRootPart.Position
end
mouse.Move:Connect(function()
if teleEnabled == true then
if targetedModel then
local location = camera.CFrame.Position + (mouse.Hit.Position - camera.CFrame.Position).Unit * maxRange
targetedModel.BodyPosition.Position = location
end
end
end)
--mouse.Button1Down:Connect(function()
--if target ~= nil then
--down = false
--mouse.TargetFilter = nil
--local BV = Instance.new("BodyVelocity")
--local Speed = 150
--local Force = 95000
--local TotalForce = Force
--RE.Telekinesis:FireServer(target, true)
--BV.Parent = target.HumanoidRootPart
--BV.MaxForce = Vector3.new(TotalForce,TotalForce,TotalForce)
--BV.Velocity = Character.HumanoidRootPart.CFrame.LookVector * Speed
--wait(0.2)
--BV:Destroy()
--wait(0.2)
--RE.Telekinesis:FireServer(target, false)
--wait(0.15)
--target = nil
--end
--end)*
elseif action == "TelekinesisEnd" then
print("ad")
teleEnabled = false
if targetedModel and targetedModel:FindFirstChild("BodyPosition") then
targetedModel.BodyPosition:Destroy()
end
game.ReplicatedStorage.SetNetworkOwner:FireServer(targetedModel, false)
game.ReplicatedStorage.Telekinesis:FireServer(targetedModel.Parent, false)
targetedModel = nil
end
end
end