Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

I have a remote event to fire when the player clicks a shop gui,why doesn't it work?

Asked by 5 months ago

I want the player to be able to buy an item when they click on a shop gui button, at first i put the code in a local script alone but i realised the player's money value only changed for them so i used a remote event and it didn't work, so i tried just printing a message with the remote event instead.That didn't work either, and I didn't get an error message either I re-watched tutorials on remote events and read up on filtering enabled on the roblox wiki, I watched more tutorials on remote events and found that there are also remote functions, I read post relating to remote events on the dev forum, I tried the solutions on all the sources I mentioned before and have been at it for a about 2 days and still can't find the reason the code won't work nor any clue as to a solution this is my first time using remote events, someone please help, the code is below

--Local Script(Client)
--purchase is the name of my remote event
script.Parent.MouseButton1Click:Connect(function()
game.ReplicatedStorage.purchase:FireServer()
end)
--Script(Server)
--the scripts parent is replicated storage and same for the remote event
script.Parent.purchase.OnServerEvent:Connect(function(player)
print(player.Name)
end)

1 answer

Log in to vote
1
Answered by
Misqueso 145
5 months ago

It seems that you have placed the Server Script inside the Replicated Storage. Scripts inside Replicated Storage do not execute. You should place any server scripts inside the ServerScriptService.

1
thanks alot, you hlped so much, I had no idea that was a thing, I need to look up services more yumaking 63 — 5mo
Ad

Answer this question