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!
I am making a lighter tool. -
What is the issue? Include screenshots / videos if possible!
The animation doesn’t play. - What solutions have you tried so far? Did you look for solutions on the Developer Hub? I tried no solution.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
Lighter script (inside the tool, not the handle)
--ToggleLighter.lua
local ts = game:GetService("TweenService")
local ti = TweenInfo.new(1, Enum.EasingStyle.Back, Enum.EasingDirection.In, 0, false, 0)
local goal1 = {['CFrame'] = script.Parent.Handle.CoverTweenOpen.CFrame}
local goal2 = {['CFrame'] = script.Parent.Handle.CoverTweenClose.CFrame}
local toggleMode = "Open"
script.Parent.Activated:Connect(function()
if toggleMode == "Open" then
ts:Create(script.Parent.Handle.Cover, ti, goal1):Play()
toggleMode = "Close"
script.Parent.Handle.FirePart.Fire.Enabled = true
script.Parent.Handle.FirePart.PointLight.Enabled = true
else
ts:Create(script.Parent.Handle.Cover, ti, goal2):Play()
toggleMode = "Open"
script.Parent.Handle.FirePart.PointLight.Enabled = false
script.Parent.Handle.FirePart.Fire.Enabled = false
end
end)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.