In this script I am trying to pass a RemoteEvent once you say "Hello" But nothing is working, and theres no errors.
Script:
local replicatedstorage = game:GetService("ReplicatedStorage") local RemoteEventConnection = game.ReplicatedStorage:WaitForChild("CommissionTest") local player = game.Players.LocalPlayer local GamePassId = 6766156 -- Replace with your gamepass local WhitelistUserIDs = { --Your PlayerId's here 79523404, 0, 1, 2 } if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, GamePassId) == true or table.find(WhitelistUserIDs, player.UserId) then print("First") function onChatted(message, player) if message == "Hello" and game.MarketplaceService:UserOwnsGamePassAsync(player.UserId, GamePassId) then print("message sent") RemoteEventConnection:FireServer(GamePassId,WhitelistUserIDs) end end end game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(message) onChatted(message, player) end) end)
don't really recommend using this from a local script, way more secure while checking on the server, also wouldn't need the remote.
local ReplicatedStorage = game:GetService("ReplicatedStorage") local MarketplaceService = game:GetService('MarketplaceService') local RemoteEventConnection = ReplicatedStorage:WaitForChild("CommissionTest") local player = game.Players.LocalPlayer local GamePassId = 6766156 local WhitelistUserIDs = { 79523404; } function onChatted(message) if message == "Hello" then print("message sent") RemoteEventConnection:FireServer(GamePassId, WhitelistUserIDs) end end -- makes sure you're allowed to use the command, this one check is enough. don't need to check again in function. if MarketplaceService:UserOwnsGamePassAsync(player.UserId, GamePassId) or table.find(WhitelistUserIDs, player.UserId) then player.Chatted:Connect(onChatted) end