|
| 30 Oct 2017 09:36 PM |
function touchedTrigger() if touched == true then touched = false print("trigger activated") touchedEvent:FireClient() wait(2) touched = true end end homeTrigger.Touched:connect(touchedTrigger)
what i tried didnt work
how can i fire the remote event in this function
|
|
|
| Report Abuse |
|
|
| |
|
WildGuest
|
  |
| Joined: 28 Feb 2010 |
| Total Posts: 647 |
|
|
| 30 Oct 2017 09:47 PM |
Did you define the RemoteEvent? Add this the very top of the script.
local repStorage = game:GetService("ReplicatedStorage") local touchedEvent = repStorage:WaitForChild("touchedEvent")
|
|
|
| Report Abuse |
|
|
|
| 30 Oct 2017 10:21 PM |
Argument 1 missing or nil
"touchedEvent:FireClient()
on the wiki they connect the event by doing something like this
local function PlayerAdded(player) touchedEvent:FireClient(player) end Players.PlayerAdded:Connect(PlayerAdded)
but now sure how to make this work w/ a touched event
the problem isn't w/ defined variables
|
|
|
| Report Abuse |
|
|
|
| 30 Oct 2017 10:38 PM |
plz help
u will be greatness
|
|
|
| Report Abuse |
|
|
WildGuest
|
  |
| Joined: 28 Feb 2010 |
| Total Posts: 647 |
|
|
| 30 Oct 2017 10:54 PM |
Late, but you have to define the player for the server to know which client to fire.
touchedEvent:FireClient(player)
|
|
|
| Report Abuse |
|
|
|
| 30 Oct 2017 11:04 PM |
that just gives another error because player isnt really defined
|
|
|
| Report Abuse |
|
|
WildGuest
|
  |
| Joined: 28 Feb 2010 |
| Total Posts: 647 |
|
|
| 30 Oct 2017 11:09 PM |
homeTrigger.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") ~= nil then local player = game.Players:GetPlayerFromCharacter(hit.parent) if touched == true then touched = false print("trigger activated") touchedEvent:FireClient(player) wait(2) touched = true end end end)
|
|
|
| Report Abuse |
|
|
|
| 30 Oct 2017 11:24 PM |
that works
appreciate the help
|
|
|
| Report Abuse |
|
|