Just start i'm really new with scripting so sorry if some of my questions are really easy.
I've been trying to make a rocket ship and in order to launch it I want to use an on screen button that is clicked to start the launching process.
Located in Startgui I have ScreenGui > TestButton > Script
The script contains
function onClicked() print("Orefef") end script.Parent.MouseButton1Click:connect(onClicked)
Whenever I click on the button, "Orefef" does not print so obviously the button does not work. Probably a really dumb mistake but any help would be great.
Make sure to put the script in a local script, since this is client side and it should work!
Like Feahren said in the comments, you need to use a LocalScript for the button to work from a Gui (these are client specific)
Local Script
script.Parent.Activated:Connect(function() print("Orefef") end)
Activated is preferred since it works on all devices, not just computers.
This script is fine if you want only the player that clicked the button to see the launch, otherwise, if all players will see it, you need to use Remote Functions & Events as outlined here: https://wiki.roblox.com/index.php?title=Remote_Functions_%26_Events
Example of Remote Event
Local Script
local remote = game.ReplicatedStorage.RemoteEvent script.Parent.Activated:Connect(function() print("Orefef") remote:FireServer() end)
Server Script
local remote = game.ReplicatedStorage.RemoteEvent remote.OnServerEvent:Connect(function(player) -- Causes Rocket to Launch end)
For the above example, I have a Remote Event in Replicated Storage named "RemoteEvent"