Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to use InputBegan and InputEnded in this one?

I want to script it so that when I press R the ball will slowly go bigger and when i unpress R it will throw it~~~~~~~~~~~~~~~~~



UIS.InputBegan:Connect(function(Input, isTyping) if not isTyping then

if Input.KeyCode == Enum.KeyCode.R and not debounce then
	debounce = true
		fireball:FireServer(player:GetMouse().Hit.p)
		print(player:GetMouse().Hit.p)
		wait()
	debounce = false
	end 

end

end)

UIS.InputEnded:Connect(function(Input, isTyping)

if not isTyping then
	
	if Input.KeyCode == Enum.KeyCode.R and not debounce then
		
		
	end
end

end)

I do not know what to write in 

local fireball = game:GetService("ReplicatedStorage"):FindFirstChild("fireball")

fireball.OnServerEvent:Connect(function(player, mousePos)

local character = player.Character

local fireball = game:GetService("ReplicatedStorage"):FindFirstChild("Fireball"):Clone()
fireball.Parent = game.Workspace
fireball.Size = Vector3.new(2, 2, 2)
fireball.CFrame = character:WaitForChild("HumanoidRootPart").CFrame * CFrame.new(0, 10, 0)
fireball.Massless = true

local TweenService = game:GetService("TweenService")
local Info = TweenInfo.new(3, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out, 0, false, 0)
local properties = {
	Color = Color3.fromRGB(255, 0, 0),
	Size = Vector3.new(15, 15, 15),
	Anchored = true
}
local Tween = TweenService:Create(fireball, Info, properties)
Tween:Play()
Tween.Completed:Wait()
fireball.Anchored = false

local bv = Instance.new("BodyVelocity", fireball)
bv.Velocity = CFrame.new(fireball.CFrame.Position, mousePos).lookVector * 50
bv.MaxForce = Vector3.new(math.huge, math.huge, math.huge)

end)

This line already makes it bigger but I dont know how to put it to InputBegan as it will error

Thanks in advance!

1 answer

✓ Accepted answer

Add a new event start growing and stop growing implement debounce server side on InputBegan start start growing event that will grow the fireball changing scale or using tween service for smoother stuff

2 comments

0

is possible to use tween service on a module? if so how?

0

Probably the same way

This discussion is preserved as it was. New answers, comments, and votes are closed.