Hey! I'm trying to make a game and I have a wand, and When I press E I have a delay for it and it plays an animation. How can I make it so:
I get my Explosion spell (2 Parts, nothing else) from ReplicatedStorage or somewhere else
Change My ExplosionBeam (I have an Explosion Beam and a Explosion End) to be longer or shorter depending on where the mouse is
When pressing E, Direct the spell to the mouse cursor.
So for short, I want 2 parts (an explosion beam and it's end) to go to where my mouse is on the screen and Put my Beam to start from my wand
Really need help on this one, as I have everything except for the script..
local player = game.Players.LocalPlayer
local Tool = script.Parent
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local debounce = false -- New variable
local waitTime = 3 -- New variable
local frame = player.PlayerGui:WaitForChild("MageGui").MainFrame.Ebackground.Edelay
local DelayGui = player.PlayerGui:WaitForChild("MageGui").MainFrame.Ebackground.Edelay.Edelay
local function debounceToFalse(didComplete)
if didComplete then
debounce = false
else
print("Something went wrong")
end
end
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local AnimE = Instance.new("Animation")
AnimE.Name = "AnimE"
AnimE.Parent = script.Parent
AnimE.AnimationId = "http://www.roblox.com/asset/?id=6757120886"
local animEtrack = humanoid:LoadAnimation(AnimE)
UserInputService.InputBegan:Connect(function(key, gameProcessed)
if key.KeyCode == Enum.KeyCode.E and not gameProcessed and not debounce then
debounce = true
animEtrack:Play()
frame.Size = UDim2.new(0, 1, 0, 39)
frame:TweenSize(
UDim2.new(0, 225, 0, 39),
Enum.EasingDirection.In,
Enum.EasingStyle.Linear,
waitTime,
true,
debounceToFalse
)
end
end)
