``local UIS = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local event = ReplicatedStorage:FindFirstChild("Events"):FindFirstChild("ShootEvent")
local Players = game:GetService("Players")
local CS = game:GetService("CollectionService")
local plr = Players.LocalPlayer
local cd = true
local sound = script["spy revolver fire sound"]
UIS.InputBegan:Connect(function(input, gameProcessedEvent)
local character = plr.Character or plr.CharacterAdded:Wait()
if CS:HasTag(plr.Character, "Character") then
if character.Name == "Cowboi" then
if gameProcessedEvent then return end
if input.UserInputType == Enum.UserInputType.MouseButton3 and cd == true then -- MouseButton3 is middle mouse
cd = false
print("yay")
local char = plr.Character or plr.CharacterAdded:Wait()
local revolver = char.Revolver
if revolver then
local shootFrom = revolver:FindFirstChild("ShootFrom")
if shootFrom then
local shootCF = shootFrom.CFrame
event:FireServer(char, shootCF) -- send CFrame, not Position
else
warn("ShootFrom part not found in Revolver")
end
else
warn("Revolver not found in character")
end
sound:Play()
task.wait(5)
cd = true
print("cd done")
end
end
end
end)``
If i put the Cowboi(with tags and revolver)
And the script is in the StarterPlayerScripts
Then it works perfectly
But if i make it when u press a button it changes u to that starter character then it wont work(it is in replicatedstorage and puts it into playerscripts this time its not in StarterPlayerScripts)