I am currently working on my “Find the Frogs” game, and I’m encountering an issue which only recently popped up with one of the special frogs. I have a regular script in the server script service which (simply) detects if a frog’s primary part (which serves as a collision detection box) has been touched, and fires an event to the client:
for i, frog in pairs(workspace.allFrogs:GetChildren()) do
frog.PrimaryPart.Touched:Connect(function(hit) –- If the collider is touched
if game.Players:GetPlayerFromCharacter(hit.Parent) then –- Check if touched by player
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local FoundFrogEvent = game.ReplicatedStorage.Events.FoundFrogPopup
if not game.Players:GetPlayerFromCharacter(hit.Parent).FROGS:FindFirstChild(frog.Name) then -- Check if the player has already collected
local frogVal = Instance.new("StringValue") -- If not >> save the collected frog value
FoundFrogEvent:FireClient(player, frog.Name, frog) -- send req. for gui popup
frogVal.Name = frog.Name
frogVal.Parent = game.Players:GetPlayerFromCharacter(hit.Parent).FROGS -- parent value to the player's frog collected cache
end
end
end)
end
A script that was previously working, being a local script in Starter player scripts has stopped working :
local OSF = workspace.allFrogs:WaitForChild(“Orange Striped Frog”)
local collide = OSF.PrimaryPart
local button = workspace.MapButtons:WaitForChild(“FrogButton”)
local clickDetect = button:WaitForChild(“ClickDetector”)
clickDetect.MouseClick:Connect(function()
print(“Clicked”)
collide.CanTouch = true
end)
When touched in game, the server script does not trigger the event. I checked in the explorer too and it says the CanTouch property is set to true.
Any Ideas as to why this is not working please? Thank You