This is A server Script, I want It To only Clone it to the person That triggered the Server event.
game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(char) Q.OnServerEvent:Connect(function(player) local soundQ = Instance.new("Sound", char:WaitForChild("RepSkills")) soundQ.SoundId = "rbxassetid://7135506438" soundQ.Name = "QSound" local QClone = QSkill:Clone() soundQ:Play() QClone.Parent = char:WaitForChild("RepSkills") QClone.CFrame = char.HumanoidRootPart.CFrame * CFrame.new(0,-2.7,0) wait(.8) QClone:Destroy() soundQ:Destroy() end) end) end)
This is because when a player and character joins, the Onserverevent function is made. This means when 3 players join, the function is made 3 times. When the Server event is fired, the function fires 3 times. All 3 players get the clone because the function fired 3 times and the character you are using are the character of those who joined (Which is all 3 players) instead of only the character that fired the serverevent. Basically there are 2 problems. 1. Dont put Onserverevent function inside the player added and character added function or else it will be made every time the player joins. Just put it on the outside, or in your case, you dont even need the player added or character added functions. 2. Use the character of the player that fired the ServerEvent and not the character that was added because they could be different characters and therefore fire for different players.
Q.OnServerEvent:Connect(function(player) local char = player.character local soundQ = Instance.new("Sound", char:WaitForChild("RepSkills")) soundQ.SoundId = "rbxassetid://7135506438" soundQ.Name = "QSound" local QClone = QSkill:Clone() soundQ:Play() QClone.Parent = char:WaitForChild("RepSkills") QClone.CFrame = char.HumanoidRootPart.CFrame * CFrame.new(0,-2.7,0) wait(.8) QClone:Destroy() soundQ:Destroy() end)