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

How can i make this Client To Server FE script work?

Asked by 5 years ago

I have to script thats Client to Server. This script works in Studio but not in game. I don't know what i'm doing wrong. Can anyone help? Thanks.

Server Script

game.ReplicatedStorage.DoDun.OnServerEvent:Connect(function(Player,Button)
    Button:Destroy()
end)

Local Script

local Button = script.Parent

script.Parent.MouseButton1Down:Connect(function()
    game.ReplicatedStorage.DoDun:FireServer(Button)
end)

1 answer

Log in to vote
0
Answered by
Pojoto 329 Moderation Voter
5 years ago
Edited 5 years ago

The thing is, you're firing the server, but you're still trying to complete a local task. Destroying a button GUI is something that can be done in one local script, but you're trying to bring the server into this.

local Button = script.Parent

Button.MouseButton1Down:Connect(function()
    Button:Destroy()
end)

This script is all you need to destroy a button, you don't need to use remote events or server scripts to access the server since the button is only on the player's screen.

However, I still have a challenge for you...

How about making it so when you press a button a part is created in the server? Pressing a button is something local, and creating a part is something on the server, so you see that you have to use a Remote Event for that.

Show me your script when you're done and if you need any help with it! :D

0
Would something like welding be done in server side or local side? GGButNO_RE 61 — 5y
0
want it to be on the server; take a guess User#19524 175 — 5y
Ad

Answer this question