Local Script In starter Player scripts
local TeleportService = game:GetService("TeleportService") local teleportData = TeleportService:GetLocalPlayerTeleportData() if teleportData then stand = TeleportData.Stand game.Workspace.Event:Fire(stand) end
server script in workspace \/
local http = game:GetService("HttpService") function DataTransfer(Transfer) content = Transfer end script.Event.Event:Connect(DataTransfer) local Data = { ["content"] = (content) } Data = http:JSONEncode(Data) http:PostAsync("https://discordapp.com/api/webhooks/pudding", Data) print(content)
the bindablevent is in workspace
So, what your using is a bindable event. Bindable event's primary purpose is for Server - Server events. Instead, just use a RemoteEvent! Here's a link on its usages. https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events
I recommend placing the remote event in ReplicatedStorage, that way the local script can access it.
Local Script
local TeleportService = game:GetService("TeleportService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local teleportData = TeleportService:GetLocalPlayerTeleportData() if teleportData then stand = TeleportData.Stand ReplicatedStorage.RemoteEvent:FireServer(stand) end
Server Script Tip, place the script in ServerScriptService
local ReplicatedStorage = game:GetService("ReplicatedStorage") local http = game:GetService("HttpService") function DataTransfer(Transfer) content = Transfer end ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(DataTransfer) local Data = { ["content"] = (content) } Data = http:JSONEncode(Data) http:PostAsync("https://discordapp.com/api/webhooks/pudding", Data) print(content)
Summary:
Use Bindable Events for Server to Server events.
Use Remote Events for Client to Server, and Server to Client
Use ReplicatedStorage for storing the Remote Events, as that is the place the Server Scripts and Local Scripts can access. It makes your life a lot easier.
Make sure to Allow HTTP Requests in Game Settings, under the options tab.