So basically, I have a script in a part, but I don't know how to fire the client via a script using a RemoteEvent. Here's the Script in the Part
1 | function onTouched(part) |
2 | game.ReplicatedStorage.Coins.TYBPitks:FireClient() |
3 | end |
4 |
5 | script.Parent.Touched:connect(onTouched) |
Thanks in Advance — DindinYT37
I'm assuming this is what you want.
Put this block of code in a LocalScript
and change the line below local function OnConnect()
to what you prefer the function to do.
1 | local Event = game.ReplicatedStorage.Coins.TYBPitks --Indexes placement of event |
2 | local function OnConnect() --When connected |
3 | print ( "Connected!" ) --Action |
4 | end |
5 | Event.OnClientEvent:Connect(OnConnect) --Tell the function when to activate |
Also, you might want to read up on Debounce as this script would cause several events to fire.