of     1   

DanPai
#226667215Saturday, October 21, 2017 11:43 PM GMT

This script is supposed to give you a uniform when you touch a button but it gives everyone the uniform when one person touches it. local RemoteEvents = game:GetService("ReplicatedStorage"):WaitForChild("UniformEvents") local Give = RemoteEvents:WaitForChild("UTouch") debounce = false a = game.workspace.ShirtGiver.Button Shirtid = "ugh" Give.OnServerEvent:connect(function(player) local char = player.Character a.BrickColor = BrickColor.new("Deep orange") repeat wait() until char.Shirt char.Shirt:Destroy() local ashirt = Instance.new("Shirt") ashirt.ShirtTemplate = Shirtid ashirt.Name = "BaristaShirt" ashirt.Parent = char wait(1) a.BrickColor = BrickColor.new("Electric blue") end)
TheBenSquare
#226667654Saturday, October 21, 2017 11:54 PM GMT

give the other script
DanPai
#226667902Sunday, October 22, 2017 12:00 AM GMT

Player = game.Players.LocalPlayer local RemoteEvents = game:GetService("ReplicatedStorage"):WaitForChild("UniformEvents") local Give = RemoteEvents:WaitForChild("UTouch") local a = game.workspace.ShirtGiver.Button debounce = false a.Touched:connect(function(obj) if debounce == false then debounce = true if obj.Parent:FindFirstChild("Humanoid") then Give:FireServer() end wait(1) debounce = false end end)
SurKipper
#226668343Sunday, October 22, 2017 12:11 AM GMT

The LocalScript is probably running on all clients and so when the part is touched by anybody all of the clients fire their event. This would make them all get the uniform even though just one player touched it. Does it need to be a RemoteEvent though? Why not something like this ---------- script.Parent.Touched:connect(function(part) if game:GetService('Players'):GetPlayerFromCharacter(part.Parent) then local Character = part.Parent -- do stuff end end) ----------
DanPai
#226669138Sunday, October 22, 2017 12:30 AM GMT

Yeah I have FE enabled
TheBenSquare
#226669379Sunday, October 22, 2017 12:37 AM GMT

It's exactly what kipper mentioned. In order to resolve this, try and check and see if the character that hit the part is the local player's character. If it isn't, ignore the event. If it is, proceed as normal.
DanPai
#226669660Sunday, October 22, 2017 12:43 AM GMT

okay, thanks, I'll try that :)
DanPai
#226711233Sunday, October 22, 2017 8:26 PM GMT

still makes everyone wear it LOCAL Player = game.Players.LocalPlayer local RemoteEvents = game:GetService("ReplicatedStorage"):WaitForChild("UniformEvents") local Give = RemoteEvents:WaitForChild("UTouch") local a = game.workspace.ShirtGiver.Button debounce = false a.Touched:connect(function(obj) if debounce == false then debounce = true if obj.Parent:FindFirstChild("Humanoid") then local char = Player.Character.Name Give:FireServer(char) end wait(1) debounce = false end end) SERVER local RemoteEvents = game:GetService("ReplicatedStorage"):WaitForChild("UniformEvents") local Give = RemoteEvents:WaitForChild("UTouch") debounce = false a = game.workspace.ShirtGiver.Button Shirtid = "h############################################ Give.OnServerEvent:connect(function(player, character) if player.Character.Name == character then local char = player.Character a.BrickColor = BrickColor.new("Deep orange") repeat wait() until char.Shirt char.Shirt:Destroy() local ashirt = Instance.new("Shirt") ashirt.ShirtTemplate = Shirtid ashirt.Name = "BaristaShirt" ashirt.Parent = char wait(1) a.BrickColor = BrickColor.new("Electric blue") end end)
SurKipper
#226749382Monday, October 23, 2017 8:37 PM GMT

Instead of passing 'Player.Character.Name' use 'obj.Parent.Name'. Using 'Player.Character.Name' will still send the LocalPlayer's name, so every player will get the shirt.
igrach2
#226749863Monday, October 23, 2017 8:51 PM GMT

-- put Script in brick local Shirtid="" local Shirtname="BaristaShirt" local Shirt="Shirt" script.Parent.Touched:Connect(function(v) v=v.Parent:FindFirstChildOfClass(Shirt) if v and v.ShirtTemplate~=Shirtid then v.ShirtTemplate=Shirtid v.Name=Shirtname end end)

    of     1