Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is my remote event not connecting when the part is touched?

Asked by 4 years ago

So i need this remote event to connect so that the player can get the gui when they touch this part but its not firing or printing anything and there are no errors pls help

local blind = script.Parent
local re = game.ReplicatedStorage.RemoteEvent

blind.Touched:Connect(function(hit)
local human = hit.Parent:findFirstChild("Humanoid")
        if (human ~= nil) then


print("fired")
   re:FireServer()
end
end)
0
Is this script local or a serverscript User#34929 0 — 4y
0
local coolmanHDMI 72 — 4y
0
make the script a serverscript and get the player to fire a client evetn User#34929 0 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago

So, what you need to do is:

Put it in a serverscript.

local blind = script.Parent
local re = game.ReplicatedStorage.RemoteEvent

blind.Touched:Connect(function(hit)
local human = hit.Parent:findFirstChild("Humanoid")
        if (human ~= nil) then
              local player = game.Players:GetPlayerfromCharacter(hit.Parent) --[[You have to get the player, not the Character or humanoid]]
              re:FireClient(player)
              print("fired")
end
end)
Ad
Log in to vote
0
Answered by 4 years ago

maybe use just serverside

Answer this question