The script I made firstly was server side, but what I’d like to do is a proximity prompt that opens a GUI with TweenService, but the tween is laggy on server side, that’s why I’m trying to do it client side. I’d like also to add sounds for client only
when I try to execute this script it won’t work for some reasons
You can fire a RemoteEvent to the client and in the LocalScript you simply play the sound.
Pretty much something like this should work:
local Remote = game:GetService("ReplicatedStorage"):WaitForChild("RemoteName")
local ProximityPrompt = ....... -- Path to the proximity prompt
ProximityPrompt.Triggered:Connect(function(player)
Remote:FireClient(player)
end)
And in the localscript you should have something like this:
local Remote = game:GetService("ReplicatedStorage"):WaitForChild("RemoteName")
local Sound = ........ -- Path to the sound you want to play
Remote.OnclientEvent:Connect(function()
Sound:Play()
end)
Try to place a localscript in StarterplayerScripts or StarterGui, wherever you please, use a RemoteEvent to be fired in the code I provided above in the server, pick up the RemoteEvent in the LocalScript and play the sound from there on.
Remember, localscripts can only be used in:
-StarterGui
-StarterPlayerScripts
-StarterCharacterScripts
-ReplicatedFirst
Let me know if you’re having any further trouble with this.