You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
Hello! I want to successfully make a “Rasengan” script so that when you activate the tool, the rasengan part grows to the desired size and if, after 6 seconds, no other humanoids have touched it and taken 50 damage, the part size goes back to 0.
The output shows:
I’ve tried lots of solutions, including searching up on YouTube and the DevForum
Localscript:
local tool = script.Parent
local activated = tool:WaitForChild("Activated")
local done = tool:WaitForChild("Done")
local canuse = true
local player = game.Players.LocalPlayer
tool.Activated:Connect(function()
if canuse == true then
activated:FireServer(player)
canuse = false
else return tool.Activated
end
end)
done.OnClientEvent(function(player)
canuse = true
end)
Serverscript:
local tool = script.Parent
local activated = tool:WaitForChild("Activated")
local rasengan = tool:WaitForChild("Handle")
local done = tool:WaitForChild("Done")
local tweenservice = game:GetService("TweenService")
local db = false
local tick = 6
local goal = {
Size = 2.5, 2.5, 2.5
}
local info = TweenInfo.new(1.0, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0)
activated.OnServerEvent:Connect(function(player)
local tween = tweenservice:Create(rasengan, info, goal)
tween:Play()
tween.Completed:Connect(function()
while wait(0.1) do
local otherhum = rasengan:FindFirstChild("Humanoid")
if tick <= 0 then
rasengan.Size = 0
done:FireClient()
break
end
if otherhum and otherhum.Parent.Name ~= player.Name then
otherhum:TakeDamage(50)
else
tick = tick - 0.1
end
end
end)
end)
Also, if you spot any other areas or places in my code that I should improve on, please let me know!