Problem with firing an event .Touched

i’m trying to make a part fire a remote event when touched by a part named “tax”, but nothing happens. no errors, just… nothing. here is the local script:

local remote = game:GetService("ReplicatedStorage").Remotes.GiveCurrency


script.Parent.Touched:Connect(function(hit)
	if hit.Name == "tax" then
		print("part touched")
		remote:FireServer()
		hit:Destroy()
	end
end)

if you know what is causing this, or need more information, please reply!

If this is located inside of a part, this script won’t execute. LocalScripts can only run in client services (like StarterGui or StarterPlayerScripts, for example) With the exception of the player’s own character model.

You could put your script in StarterCharacterScripts, and then define a reference to the part you want the player to be able to touch.

1 Like

comment above is right
but heres an unrelated question
I see that you’re calling a remote from the client to the server
do you have any checks to ensure that exploiters cannot manipulate that remote to give themselves money?

1 Like

Sorry for the late reply, I didn’t realize I couldn’t execute it from a part for some odd reason. Thanks a lot for your help!

1 Like