CD.Triggered:Connect(function(Player)
local tool = character:FindFirstChildOfClass("Tool")
if tool == nil then end
if tool.Name ~= nil then
local Name = tool.Name
print(Name)
When proximity prompt is triggered this dont character:FindFirstChildOfClass("Tool")
No need to define player twice in this case. You could use the Player parameter to get the character. It happens possibly because you have 'Player(localplayer)andPlayer(parameter)`
local localplayer = game:GetService("Players").LocalPlayer
local character = localplayer.Character
local Humanoid =character:FindFirstChild('Humanoid')
local ss = game:GetService("ServerStorage")
local rs = game:GetService("ReplicatedStorage")
local localplayer = game:GetService("Players").LocalPlayer
local character = localplayer.Character
local Humanoid =character:FindFirstChild('Humanoid')
local Dirt = script.Parent.Parent.Parent
local CD = script.Parent
local chest = script.Parent.Parent.Parent.Chest
local Click = script.Parent.Parent
local data = rs.FetchClientData:InvokeServer()
local counter = 0
local db = false
local Z = chest.Position.Z
local X = chest.Position.X
local Y = chest.Position.Y
CD.Triggered:Connect(function(Player)
print("t")
local tool = character:FindFirstChildOfClass("Tool")
if tool == "" then end
if tool.Name ~= nil then
local Name = tool.Name
if db == false then
db = true
local Y = chest.Position.Y + 1
chest.Position = Vector3.new(X,Y,Z)
counter += data[Name].Damage
else
if counter > 6 then
Click:Destroy()
end
wait(0.1) db = false
end
end
end)
The problem is as I said that proximity prompt’s don’t work with local scripts only server scripts. So he’ll have to fire and event from the server to the client.