Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Localscript within TextButton will not activate?

Asked by 5 years ago

I have the follow script in startgui > ScreenGui > TextButton > LocalScript

script.Parent.Activated:Connect(function() game.Workspace.Rocket.Boosters1.Velocity=game.Workspace.Rocket.Boosters1.CFrame.lookVector * 700 game.Workspace.Rocket.Boosters2.Velocity=game.Workspace.Rocket.Boosters2.CFrame.lookVector * 700 game.Workspace.Rocket.Boosters3.Velocity=game.Workspace.Rocket.Boosters3.CFrame.lookVector * 700 game.Workspace.Rocket.Boosters4.Velocity=game.Workspace.Rocket.Boosters4.CFrame.lookVector * 700 end)

whenever I click the button the rocket does not launch, anyone know how to fix this?

1
^ Actually the Activated event exists for GUI buttons too : https://developer.roblox.com/api-reference/event/GuiButton/Activated User#20279 0 — 5y

1 answer

Log in to vote
0
Answered by
Ziffixture 6913 Moderation Voter Community Moderator
5 years ago
Edited 5 years ago

According to the DeveloperWiki, .Activated fires when a GUIButton is selected when pressing A. I don’t think this is the best method for listening for Click Signals. It’s best to use .MouseButton1Click instead, as it’s fully built to listen for Left-Click interaction with the Button.

local Button = script.Parent

Button.MouseButton1Click:Connect(function()
   print("Clicked!")
end)

You can use this and apply your Code accordingly, if this helps, don’t forget to accept this answer!

0
wrong wrong activated is an event for buttons this is bad User#24403 69 — 5y
Ad

Answer this question