...How to fix -_-

OnClientEvent can only be used on the client.

else if i apply "FireServer"

FireServer can only be called from the client.

Script:

local message = "Hello world!"

script.Parent.Touched:connect(function(h)
	--// My Code Here
	game.ReplicatedStorage.NewMsg:FireClient(player,message)
end)

Client:

local Module = require(game.ServerScriptService.ModuleScript)

game.ReplicatedStorage.NewMsg.OnClientEvent:connect(function(player,message)
	Module.NewMessage(player,message)
end)

Module:

local module = {}

function module.NewMessage(player,message)
	--// My Code Here
end

return module

as usual the script works in Studio... --"

2 comments

0

is the client script a local script?

0

No?