needing help linking a clickdetector in workspace with serverstorage script?
Asked by
4 years ago Edited 4 years ago
Hello, today I am trying to make a dollar where when the player clicks the dollar adds to the player's wallet everything is fine but I can't use a remote function with server scripts
to go more into the basis of the situation I have a dollar and it's linked to a click detector when the player clicks it's supposed to trigger the remote function but the issue is that remote functions are client-server relationship and scripts are server and you cant have local scripts in workspace to trigger the remote function
so my question is how can I get my script to trigger the remote function then return a value
my code for the dollar in workspace, IT ISA A SCRIPT NOT LOCAL SCRIPT:
1 | local dollar = script.Parent |
2 | local replicatedStorage = game:GetService( "ReplicatedStorage" ) |
4 | local clickdetector = dollar.ClickDetector |
6 | clickdetector.MouseClick:Connect( function (player) |
7 | local money = replicatedStorage.moneyGrabRemoteEvent:InvokeServer(player, 100000 ) |
EDIT: figured it out i used a local script in starter playerscripts to detect the click detector in workspace then i used the event ty