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

needing help linking a clickdetector in workspace with serverstorage script?

Asked by
x28_97 -9
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:

local dollar = script.Parent
local replicatedStorage = game:GetService("ReplicatedStorage")

local clickdetector = dollar.ClickDetector

clickdetector.MouseClick:Connect(function(player)
    local money = replicatedStorage.moneyGrabRemoteEvent:InvokeServer(player, 100000)
    dollar:Destroy()
end)

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

0
Code blocks please. There is a random ad in the middle of your code because it is not in code blocks kingblaze_1000 359 — 4y
0
Remove local money= but keep what's after Spjureeedd 385 — 4y
0
You'd have to create a remote event that went to the server, as there's no parameter for clickdetectors. ParticularlyPenguin 71 — 4y
0
You can change the values from a ServerScript. youtubemasterWOW 2741 — 4y
View all comments (2 more)
0
code blocks ok im sorry king, spj i tried didnt work, penguin i did i think?, youtube thanks i just figure out about fireserver ty, still needing help >.< x28_97 -9 — 4y
0
figured it out i used a local script in starter playerscripts to detect the click detector in workspace then i used the event ty x28_97 -9 — 4y

Answer this question