#Its supposed to increase strength value when clicked

58 messages · Page 1 of 1 (latest)

rare tinsel
#

Y'know you could take a screenshot on your PC, right?

jagged phoenix
#

my messges getting deleted

rare tinsel
jagged phoenix
#

local Players = game:GetService("Players")
local ServerScriptService = game:GetService("ServerScriptService")

local Template = require(ServerScriptService.PlayerData.Template)
local Manager = require(ServerScriptService.PlayerData.Manager)
local ProfileService = require(ServerScriptService.Libs.ProfileService)

local ProfileStore = ProfileService.GetProfileStore("Production", Template)

local KICK_MESSAGE ="bro flew a little too close to the SIGMA"

local function CreateLeaderstats(player: Player)
local profile = Manager.Profiles[player]
if not profile then return end

local leaderstats = Instance.new("Folder", player)
leaderstats.Name = "leaderstats"

local strength = Instance.new("NumberValue", leaderstats)
strength.Name = "Strength"
strength.Value = profile.Data.Strength

local gems = Instance.new("NumberValue", leaderstats)
gems.Name = "Gems"
gems.Value = profile.Data.Gems

end

local function LoadProfile(player: player)
local profile = ProfileStore:LoadProfileAsync("player_"..player.UserId)
if not profile then
player:Kick("")
return
end

profile:AddUserId(player.UserId)
profile:Reconcile()
profile:ListenToRelease(function()
    Manager.Profiles[player] = nil
    player:Kick(KICK_MESSAGE)
        
    end)
    if player:IsDescendantOf(Players) == true then
        Manager.Profiles[player] = profile
        CreateLeaderstats(player)
    else
        profile:Release()
        
    end

end

for _, player in Players:GetPlayers() do
task.spawn(LoadProfile, player)

end

Players.PlayerAdded:Connect(LoadProfile)
Players.PlayerRemoving:Connect(function(player)
local profile = Manager.Profiles[player]
if profile then
profile:Release()
end
end)

#

First one

#

Manager script local Manager = {}

Manager.Profiles = {}

function Manager.AdjustStrength(player: Player, amount: number)
local profile = Manager.Profiles[player]
if not profile then return end
profile.Data.Strength += amount
player.leaderstats.Strength.Value = profile.Data.Strength
end

return Manager

#

local Template = {
Strength = 0,
Gems = 0,
}
return Template

#

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerScriptService = game:GetService("ServerScriptService")

local Remotes = ReplicatedStorage.Remotes
local PlayerData = require(ServerScriptService.PlayerData.Manager)

local function Strength(player: Player)
PlayerData.AdjustStrength(player, 1)
end

Remotes.Strength.OnServerEvent:Connect(Strength)

pine hornetBOT
#

studio** You are now Level 1! **studio

jagged phoenix
#

local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Remotes = ReplicatedStorage.Remotes
local StrengthRemote = Remotes.Strength

UserInputService.InputBegan:Connect(function(input, processed)
if processed then return end
print("InputBegan event fired.")
if input.UserInputType == Enum.UserInputType.MouseButton1
or input.UserInputType == Enum.UserInputType.Touch
or input.KeyCode == Enum.KeyCode.ButtonR2 then
Remotes.Strength:FireServer()
print("Hello")
end
end)

#

Should i restart entirely on it?

rare tinsel
#

How much have you debugged?

jagged phoenix
#

what do you mean

#

There arent anymore errors in the console but it still doesnt work

rare tinsel
#

Yes, scripts can contains faults that don't raise errors

#

Do you know how to use the debugger?

jagged phoenix
#

No

rare tinsel
#

Does your script eventually work, or does it stay static?

jagged phoenix
#

the debugging tool gray like i cant click it

#

is it the step into/over/out tool?

rare tinsel
#

Review the article I sent

jagged phoenix
#

where do i set a breakpoint

#

so i added a breakpoint between userinput service and local strengthRemote

#

it says rendering is paused for debugging

rare tinsel
#

Stepping over iterates to the next instruction

#

Stepping into moves the debugger into a function so you can evaluate the function by stepping over it

#

Stepping out of lets you get out of that function without having to step over it completely

#

You'll probably want to start with how your server-sided logic handles the incoming request to change the player's strength

jagged phoenix
#

I put a breakpoint and there is a yellow right arrow

#

what does that mean'

jagged phoenix
#

and what if the arrow is inside of the breakpoint

#

and do i need print statements?

pine hornetBOT
#

studio** You are now Level 2! **studio

rare tinsel
#

Just step into and over, check values, notice conditions not passing

jagged phoenix
#

in the output?

#

There isnt anything

#

in output

rare tinsel
#

Dude. Read the article.

#

Absolutely nothing is sent to the output by the debugger

rare tinsel
jagged phoenix
#

Oh i understand now

#

OK so i used the debugger tool and it says "FireServer can only be called from the client"

rare tinsel
jagged phoenix
#

it said exception hit when i hovered

rare tinsel
#

#759524964977737808, screen share

jagged phoenix
#

Im gonna join on mobile

rare tinsel
#

What?

#

No.

jagged phoenix
#

how do ishare sceen

rare tinsel
jagged phoenix
#

It says you cant stream

rare tinsel
#

Make sure you're on your PC

#

I'm asking you to stream Roblox Studio as you debug your script(s)