Server
game.ReplicatedStorage.StatusChange.OnServerEvent:Connect(function(StatusText) game.Lighting.Status.Time.Text = StatusText local sound = Instance.new("Sound",game.Workspace) sound.Name = "StatusChangedSound" sound.SoundId = "rbxassetid://".."138093550" sound.Looped = true local pitcher = Instance.new("PitchShiftSoundEffect",sound) pitcher.Octave = 0.815 sound:Play() wait(2) sound:Destroy() end)
Local
script.Parent.MouseButton1Click:Connect(function() local StatusText = "Lunch" game.ReplicatedStorage.StatusChange:FireServer(StatusText) end)
Keeps saying "String Expected, Got Object"
Put .Name
at line 2 of the serverscript, so the script ends up looking like this:
game.ReplicatedStorage.StatusChange.OnServerEvent:Connect(function(StatusText) game.Lighting.Status.Time.Text = StatusText.Name local sound = Instance.new("Sound",game.Workspace) print(StatusText) sound.Name = "StatusChangedSound" sound.SoundId = "rbxassetid://".."138093550" sound.Looped = true local pitcher = Instance.new("PitchShiftSoundEffect",sound) pitcher.Octave = 0.815 sound:Play() wait(2) sound:Destroy() end)
Player
is an object value, and the script was expecting the .Name
string. Please be sure to accept the answer if you felt this helped.