I actually was checking out the API for this, though it appears that it is another situation… Therefore, I am quite unsure how I can make another event just like I did to once touching
I also used ballon.Parent.Parent == nil to try and check out if it won’t play the sound if it is unequipped… I am not sure if there are other properties to describe whether the player is equipped with the tool or not
When you unequip the tool, it’s sent to the player’s backpack, not nil
Checking on touch makes this a lot more confusing, with Equipped and Unequipped You can check these easier and thus do what you want easier. When the tool is equipped, getting the character would be script:FindFirstAncestorOfClass("Model") provided the handle isn’t in a model, which shouldn’t be the case, and when you unequip, set the stuff back to normal and :Stop() the audio
Yes, you are quite correct that it can be very confusing as putting in the touching event, although I want to make it like this based on my beginning skill from what I mostly see in the API Manual…
Continue with the discussion, I created both events for Equipped and Unequipped in the statement, but it gives me a minor problem:
local Players = game:GetService("Players")
ballon = workspace.Red_Ballon.Handle
ballon.Touched:Connect(function(hit)
local character = hit.Parent
local player = Players:GetPlayerFromCharacter(character)
if not player then
return
end
print(player.Name, player.DisplayName .. " touched the Handle!")
ballon.Parent.Parent = player.Backpack
local human = character:FindFirstChildOfClass("Humanoid")
if human then
human.UseJumpPower = true
human.JumpPower = 85
human.JumpHeight = 85
human.WalkSpeed = 16
end
ballon.Equipped:Connect(function(mouse)
print("Tool was equipped")
ballon["bounce boing sound effect"]:Play()
human.UseJumpPower = true
human.JumpPower = 85
human.JumpHeight = 85
human.WalkSpeed = 16
end)
ballon.Unquipped:Connection(function()
print("Tool was unequipped")
ballon["bounce boing sound effect"]:Stop()
human.UseJumpPower = true
human.JumpPower = 50
human.JumpHeight = 7.2
human.WalkSpeed = 16
end)
end)
Not sure if I need to put outside of the .Touched event at this point
Equipped and Unequipped are events for tools, so in your case, Red_Ballon has to be connected to them, not the handle
I think something like this would be the best choice since multiple events would be created if you go with the Touched method
local Players = game:GetService("Players")
local ballon = workspace.Red_Ballon
local character, human
ballon.Equipped:Connect(function()
character = ballon:FindFirstAncestorOfClass("Model")
human = character:FindFirstChildOfClass("Humanoid")
if not human then
return
end
print("Tool was equipped")
ballon["bounce boing sound effect"]:Play()
human.UseJumpPower = true
human.JumpPower = 85
human.JumpHeight = 85
human.WalkSpeed = 16
end)
ballon.Unequipped:Connect(function()
if not human then
return
end
print("Tool was unequipped")
ballon["bounce boing sound effect"]:Stop()
human.UseJumpPower = true
human.JumpPower = 50
human.JumpHeight = 7.2
human.WalkSpeed = 16
end)
Ye, that should be the best choice for me left, XD
Though, I feel like the ballon["bounce boing sound effect"] is quite not playing once trying the character jumps and the Humanoid.Jump is set as true… I tried making a statement, yet no results, perhaps the rest
local Players = game:GetService("Players")
local ballon = workspace.Red_Ballon
local character, human
ballon.Equipped:Connect(function()
character = ballon:FindFirstAncestorOfClass("Model")
human = character:FindFirstChildOfClass("Humanoid")
if not human then
return
end
print("Tool was equipped")
if human.Jump == true then
ballon["bounce boing sound effect"]:Play()
end
ballon["tada.wav/victory.wav HD"]:Play()
human.AutoJumpEnabled = true
human.UseJumpPower = true
human.JumpPower = 85
human.JumpHeight = 85
human.WalkSpeed = 16
end)
ballon.Unequipped:Connect(function()
if not human then
return
end
print("Tool was unequipped")
ballon["tada.wav/victory.wav HD"]:Stop()
ballon["bounce boing sound effect"]:Stop()
human.AutoJumpEnabled = false
human.UseJumpPower = true
human.JumpPower = 50
human.JumpHeight = 7.2
human.WalkSpeed = 16
end)
Try creating an event for jumping and disonnect it on unequip
local Players = game:GetService("Players")
local ballon = workspace.Red_Ballon
local character, human, jumpConnection
ballon.Equipped:Connect(function()
character = ballon:FindFirstAncestorOfClass("Model")
human = character:FindFirstChildOfClass("Humanoid")
if not human then
return
end
print("Tool was equipped")
jumpConnection = human.Jumping:Connect(function(jumping)
if not jumping then
return
end
ballon["bounce boing sound effect"]:Play()
end)
ballon["tada.wav/victory.wav HD"]:Play()
human.AutoJumpEnabled = true
human.UseJumpPower = true
human.JumpPower = 85
human.JumpHeight = 85
human.WalkSpeed = 16
end)
ballon.Unequipped:Connect(function()
if not human then
return
end
print("Tool was unequipped")
if jumpConnection then
jumpConnection:Disconnect()
end
ballon["tada.wav/victory.wav HD"]:Stop()
ballon["bounce boing sound effect"]:Stop()
human.AutoJumpEnabled = false
human.UseJumpPower = true
human.JumpPower = 50
human.JumpHeight = 7.2
human.WalkSpeed = 16
end)