Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Getting username instead of contents of TextBox?

Asked by 4 years ago
Edited 4 years ago

I don't know how to explain this, but I have this script:

--Yeah, this is the clientside part of my sound script okay, bye.

--Variables and services and stuff
local SoundService = game:GetService("SoundService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local revent = ReplicatedStorage.SoundEvent
local confirm = script.Parent.confirm
local cooldown = 5
local debounce = false
local audioid = script.Parent.Text




confirm.MouseButton1Click:Connect(function(audioid)
if not debounce then 
debounce = true
end
revent:FireServer(audioid)
wait(cooldown)
debounce = false
end)

this one sends a remote to a speaker and it's supposed to play the contents of a text box.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local revent = ReplicatedStorage.SoundEvent
local soundbox = script.Parent.Sound
local audio = script.Parent.Sound.SoundId


local function test(audioid)
audio = audioid--Ignore this part for now.
print(audioid)
end




revent.OnServerEvent:Connect(test)

this is the server. MY ISSUE: I make it print the audioid, but instead it prints my username, can anybody help? It's a GUI by the way.

0
The first parameter of an event going from client to server is the player who fired the event. So, your function should be, local function test(player,audioid). The player is ALWAYS the first argument. killerbrenden 1537 — 4y
0
@killerbrenden, It still prints out my name if I add player to it on both sides. VoidKeyword 111 — 4y
0
^^ You can just write RemoteEvent.OnServerEvent:Connect(function(_,audioid) Ziffixture 6913 — 4y
0
@Feahren, I just fixed it, but now I'm getting " Workspace.Speaker.Script:9: attempt to concatenate local 'audioid' (a userdata value)" VoidKeyword 111 — 4y

Answer this question