RemoveEvent firing after passing a wall

So I am currently making a game called walk to heaven but the issue is that I can’t trigger events after touching / passing a wall
I am using just using a Local script for the event to fire and a script to get the event

Part to fire event

script.Parent.Touched:Connect(function()
	game:GetService("ReplicatedStorage"):WaitForChild("Event"):FireServer()
end)

just a simple script
but I could not get the second script due I lost it somewhere ( I forgot to save my game )
but I made a quick script

--Properties
local NPC = script.Parent.Parent 
local CC = Enum.ChatColor.White 
local function Chat(message: string, color)
	game:GetService("Chat"):Chat(NPC.Head, message, CC)
end
event.OnServerEvent:Connect(function ()
	Chat("MAD GUY RAWR")
end)

Is your part to fire event script a local script inside of the workspace?

If so, localscripts dont work in the workspace. There are most definetly ways to handle this on the server without using remote events.

Infact, your first code should already work in a server script under your part, just remove the

game:GetService("ReplicatedStorage"):WaitForChild("Event"):FireServer()

and throw your second script in there, let me know how that goes.

1 Like

You are right

@dr12lol If you want to make it runable in workspace

Insert ServerScript and change it RunContext to Client

1 Like

Took me some time,
@xcreatee I tried using the RunContext as client but Legacy is the way.
Best way to use is the legacy way,
Thanks everyone!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.