I am making this tool Wait For "PlaceEvent", but I keep getting this error:
21:58:52.024 - Infinite yield possible on 'ReplicatedStorage:WaitForChild("PlaceEvent")'
21:58:52.026 - Stack Begin
21:58:52.026 - Script 'Players.rohanskywalker.Backpack.Grass.Main', Line 7
21:58:52.026 - Stack End
Here is the script:
-- Local Script
local tool = script.Parent
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local clickEvent = tool.ClickEvent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PlaceEvent = ReplicatedStorage:WaitForChild("PlaceEvent")
local function onActivate()
local clickLocation = mouse.hit
clickEvent:FireServer(clickLocation)
PlaceEvent:FireServer()
end
tool.Activated:connect(onActivate)
See Question&Answers more detail:os