Hello.
Its a bit hard to explain but that’s my problem :
The mechanic is simple, when the player click on the button, it make a count ( 10 → 0 ) and when it reach 0, the player can click again and claim his award. But when i try with other players, most of the time, it make the count for EVERY one, and not only for the player who click ! Why ??
LOCAL SCRIPT
button.MouseButton1Click:Connect(function(plr)
exploring.Text = "> ZONE 1 <"
if claim == true then
claim = false
return
end
if button.Text == "S E A R C H" then
remoteEventSearch:FireServer()
enduless.OnClientEvent:Connect(function(player)
cant = true
button.Text = "E R R O R /!\\"
button.BorderColor3 = Color3.new(0.709804, 0, 0)
button.TextColor3 = Color3.new(0.709804, 0, 0)
button.TextStrokeColor3 = Color3.new(0.709804, 0, 0)
wait(2)
button.BorderColor3 = Color3.new(0.290196, 0.937255, 0.596078)
button.TextColor3 = Color3.new(0.290196, 0.937255, 0.596078)
button.TextStrokeColor3 = Color3.new(0.290196, 0.937255, 0.596078)
button.Text = "S E A R C H"
return
end)
prc.OnClientEvent:Connect(function(amount)
min.Visible = false
cinq.Visible = false
dixe.Visible = false
dix.Visible = true
--button.Visible = true
--button2.Visible = false
--button3.Visible = false
local durationRemove = amount
print(durationRemove .. "hehe")
local duration = 10
local remove = duration - (durationRemove*10/100)
print(remove)
if cant == true then
sound:Play()
while wait(0.5) do
if remove <= 0 then
button.Text = "C L A I M"
break
else
button.Text = ".. " .. tostring(remove)
remove = remove -0.5
end
end
--button.Text = "C L A I M"
wait(1)
end
--local durationRemove = amount
--print(durationRemove .. "hehe")
--local duration = 10
--local remove = duration - (durationRemove*10/100)
--print(remove)
--if cant == false then
-- sound:Play()
-- while wait(1) do
-- if remove == 0 then
-- button.Text = "C L A I M"
-- break
-- else
-- button.Text = ".. " .. tostring(remove)
-- remove = remove -1
-- end
-- end
-- --button.Text = "C L A I M"
-- wait(1)
--end
end)
else
print("hlo")
return
end
end)
button.MouseButton1Click:Connect(function()
if button.Text == "C L A I M" then
sound2:Play()
remoteEvent:FireServer()
button.Text = "S E A R C H"
claim = true
dix.Visible = false
min.Visible = true
cinq.Visible = true
dixe.Visible = true
end
end)
SERVER SCRIPT
-- ACCESS EXPLO ?
replicatedStorage.data.button.search.OnServerEvent:Connect(function(player)
local actualXp = DataStore2("xp", player)
local enduranceStack = DataStore2("endurance", player)
local remoteEndu = replicatedStorage.REWARDS_EXPLO.NOENDURANCE
if enduranceStack:Get(defaultValueEndurance) < 2 then
remoteEndu:FireClient(player)
return
else
local actualTime = DataStore2("ti", player)
local timeduration = actualTime:Get(defaultDurationExplo)
local prc = replicatedStorage.data.durationPrecision
prc:FireAllClients(timeduration)
enduranceStack:Increment(-2)
end
end)