Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

This script works when I 'play solo' but does not work when I 'start a server' in studio?!

local buttonPressed = false
 
function OnHit(hit)
    if hit.Parent ~= nil then
       if not buttonPressed then
         buttonPressed = true
         local player = game.Players:playerFromCharacter()
         local msg = "This Player has completed the course."
         game.ReplicatedStorage.FilteringFunction:InvokeServer(msg)
         print("Works!")
         wait(4)

         buttonPressed = false
       
end
end
end

script.Parent.Touched:connect(OnHit)
local webhook = ""


local filteringFunction = game.ReplicatedStorage.FilteringFunction


local HTTP = game:GetService("HttpService")

function filteringFunction.OnServerInvoke(player, msg)
	local payload = HTTP:JSONEncode({
		content = msg,
		username = player.Name.." - (#"..player.UserId..")"
	})
	
	HTTP:PostAsync(webhook, payload)
end

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.