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

how can I combine localscript with script? (a strange worded question)

Asked by 3 years ago

I created a game launcher which I did in localscript. Now I need to program regular scripts as a regular script type. The problem is that localscript and the script will run at the same time. Here is a (simple) game start script:

script.Parent.MouseButton1Click:Connect(function()
    script.Parent.Parent.Visible = false
end)

Perhaps the easiest solution would be to wait a few seconds, **but the player could wait a while before pressing a button. **

so this is the situation. I hardly program (I'm better at building models) and now I need a script for my game for friends. I've been trying to solve this problem for a few days but I couldn't. Greetings KotyOceloty

1 answer

Log in to vote
0
Answered by 3 years ago

Just add a remote event. In replicated storage, Put a remote event and then use this as your local script

script.Parent.MouseButton1Click:Connect(function()
    script.Parent.Parent.Visible = false
    game:GetService("ReplicatedStorage"):FindFirstChild("RemoteEvent"):FireServer() -- fires server event
end)

So you will fire the event from the local script. And then in your script. You can just do

game:GetService("ReplicatedStorage"):FindFirstChild("RemoteEvent").OnServerEvent:Connect(function() -- fire server when server event fired
    wait('Put your time in here') -- you dont need this. but you phrased it like you wanted it to wait a second so you can use it if you want
--script here
end)

let me know if i did something wrong or i read it wrong

0
I spent way to long typing this XD Galaxybombboy 134 — 3y
0
Also, I should add. You have to put a remote event in replicated storage. or you can change the script Galaxybombboy 134 — 3y
Ad

Answer this question