I have encountered a problem in my game, when i buy a sword ( by activating a proximity prompt ), and the player gets the sword. When i try to activate it, i doesn’t work for some reason. Here’s the buy script
local pps = game:GetService("ProximityPromptService")
local repstorage = game:GetService("ReplicatedStorage")
local remotes = repstorage.Remotes
local Bremote = remotes.Buyed
local hasbuyed = false
local tweenservice = game:GetService("TweenService")
local tweeninfo = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.In)
local tweeninfo2 = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.In)
script.Parent:WaitForChild("AlreadyBought").TextLabel.Visible=true
script.Parent:WaitForChild("AlreadyBought").TextLabel.TextTransparency=1
local db = false
local required = 100
local Players = game:GetService("Players")
local tool = game:GetService("ReplicatedStorage"):WaitForChild("Tools")
local cs = tool.ClassicSword
pps.PromptTriggered:Connect(function(prompt, player)
if db == false then
if player.leaderstats.Money.Value == required or player.leaderstats.Money.Value > required then
if prompt.Name == "Buyed" then
if hasbuyed == false then
Bremote:FireServer()
local playercs = cs:Clone()
playercs.Parent = game.Workspace:FindFirstChild(player.Name)
hasbuyed = true
db = true
task.wait(5)
db = false
else
db = true
tweenservice:Create(script.Parent.AlreadyBought.TextLabel, tweeninfo, {TextTransparency = 0}):Play()
task.wait(5)
tweenservice:Create(script.Parent.AlreadyBought.TextLabel, tweeninfo2, {TextTransparency = 1}):Play()
db = false
end
end
end
end
end)
and i used a free model classic sword tool for the item