I made a button that makes a wall disappear when a button is clicked and purchased for 1000 coins using a remote event but when i click it nothing happens and theres nothing in the output
1 Like
i dont think the button.MouseButton1Click works in serverside, NOT sure, try using ClickDectector instead?
1 Like
is this a server script or a local script?
1 Like
are u sure you’re using local script
1 Like
he uses :FireServer(), which is safe to assume is a local script, but im not really sure.
1 Like
Yep, client code, but i dont see why it isnt working
sorry for the massive red lines i was just debugging myself
2 Likes
can you please show us the server script
1 Like
yeah im using a local script for it and what server script?
1 Like
i also want to point out that handling coins on client is really dangerous
1 Like
local script
local player = game.Players.LocalPLayer
local playerButton = player.StarterGui.ButtonGui.Button
local RS = game:GeService('ReplicatedStorage')
local Event = RS:WaitForChild("Event")
playerButton.MouseButtonClick:Connect(function()
Event:FireServer() --This sens the signal to the server which will await for the button to be clicked
end)
Server Script
local RS = game:GeService('ReplicatedStorage')
local Event = RS:WaitForChild("Event")
local Wall = game.Workspace.Wall
Event.OnServerEvent:Connect(function()
--Here you can put what happens when the button is clicke by a player
Wall:Destroy() --Removes the wall from the server totally
end)
1 Like
the server script that handles the remote script you’re calling
1 Like