local p = script.Parent p.Touched:Connect(function() game.ReplicatedStorage.WorldEvents.BoatShopEvent1:FireClient() end) p.TouchEnded:Connect(function() game.ReplicatedStorage.WorldEvents.BoatShopEvent2:FireClient() end)
I don't understand what I did wrong, I was told I could fire remote events from the server to the client. I attempted this, and can't find the error.
When you use :FireClient()
from a server script, you need to define what player the server is gonna fire to in the arguments. If you dont, the server doesn't actually know what client to fire to and returns nil. I think you want to fire to the player that touched the brick, so you'd use :GetPlayerFromCharacter()
to get the player.
local p = script.Parent p.Touched:Connect(function(hit) if hit.Parent:FindFirstChildOfClass("Humanoid") then local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then game.ReplicatedStorage.WorldEvents.BoatShopEvent1:FireClient(player) end end end) -- I removed the TouchEnded event, since i really didnt think you wanted to fire twice.