local Prefix = "/"
-- commands
local Balance = require(game.ServerScriptService.Commands.Balance)
local Coinflip = require(game.ServerScriptService.Commands.Coinflip)
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message)
local loweredString = string.lower(message)
local args = string.split(loweredString," ")
if args[1] == Prefix.."Balance" then
Balance.BalanceFunction(player)
elseif args[1] == Prefix.."Coinflip" then
Coinflip.CoinflipFunction(player)
end
end)
end)
local Commands = {}
Commands.BalanceFunction = function(player)
local Currency = player.PlayerGui.Currency
Currency.Enabled = true
wait(5)
Currency.Enabled = false
end
return Commands
Server does not grab direction from the client, for safety reasons the server does not replicate that data.
You would need to use :FireClient() and have a local script to enable the GUI.
Additionally you could use the serverscript to get the data of the object before giving it to the player and index from that if it is a one life per or an unmoving object.
– commands
local Balance = require(game.ServerScriptService.Commands.Balance)
local Coinflip = require(game.ServerScriptService.Commands.Coinflip)
game.Players.PlayerAdded:Connect(function(player)
if player then
player.Chatted:Connect(function(message)
local lowerMessage = string.lower(message)
if lowerMessage == Prefix.."balance" then
Balance.BalanceFunction(player)
elseif lowerMessage == Prefix.."coinflip" then
Coinflip.CoinflipFunction(player)
end
end)
end
local Prefix = "/"
-- commands
local Balance = require(game.ServerScriptService.Commands.Balance)
local Coinflip = require(game.ServerScriptService.Commands.Coinflip)
game.Players.PlayerAdded:Connect(function(player)
if player then
player.Chatted:Connect(function(message)
local lowerMessage = string.lower(message)
if lowerMessage == Prefix.."balance" then
Balance.BalanceFunction(player)
elseif lowerMessage == Prefix.."coinflip" then
Coinflip.CoinflipFunction(player)
end
end)
end
end)
local Commands = {}
Commands.CoinflipFunction = function(player)
local Coinflip = player.PlayerGui.Coinflip.MainCoinflip
if Coinflip.Enabled == false then
Coinflip.Enabled = true
end
end
return Commands
why does my command not work after the 2nd time i excute the command?