Evercyan's RPG Kit (V2)

,

Thank you! saved my life on that! I was just going to use text instead but I’ll give it a shot!

3 Likes

Every time I have an enemy it creates two enemies on the same spot, is there a way to stop this?

1 Like

Hey, do you think you could give me your place file either here or in DMs, with steps to reproduce? That’ll help a lot! I’ve been hearing about this issue occasionally.

4 Likes

Are there plans on adding new features to this kit? or is it pretty much done

4 Likes

This is a conflict with HD Admin which you might be using, specifically some map caching/restore feature - I have a fix coming out soon for this, but in the meantime, I’d make sure new mobs instances aren’t added via MobLib.new if they aren’t under Workspace.

Steps to fix mobs duplicating

  • Open “MobLib” module under ServerStorage.Modules, and go to the bottom of the script.
  • Look for a function named “GetInstanceAddedSignal” - replace this section with the code below.
CollectionService:GetInstanceAddedSignal("Mob"):Connect(function(MobInstance)
	if MobInstance:IsDescendantOf(workspace) then
		MobLib.new(MobInstance)
	end
end)

Reason being that the admin seems to clone the map and any new mobs into ServerStorage, and since it keeps its tag, MobLib will attempt to pull it back into Workspace to treat it like a new mob.

2 Likes

New update is out! This update introduces ranged weapons, hit sound effects, and several bug fixes, including more consistent hotbar saving, and a fix for mob duplication as a couple of fellow developers have pointed out.

This update changes quite a bit, so it’s highly recommended to port over every latest version of the each script (excluding configurations, only replace GameConfig) to your existing game. If you don’t think any of these additions & changes interest you, feel free to ignore this update cycle!

You can always read the entire list of changes here


As always, if you encounter any issues, or have trouble porting newer versions to your existing game, don’t be afraid to send me a message or respond to this thread. I’ll help to the best of my ability! :slight_smile:

8 Likes

How would I go about making the items in the inventory draggable on mobile because right now there is no way of sorting your inventory for mobile players. I’ve been struggling to come up with solutions for this and a large playerbase on roblox is mobile.

2 Likes

Why can’t I sell cloned tools? is there a way to fix this?

4 Likes

You aren’t typically meant to have copies of the same weapon due to how it’s saved and indexed with features such as the inventory. You likely own it for the first copy under your pData folder, but with the second copy, you don’t, so it won’t attempt to trash those copies or give you Gold for them.

if not pData.Items[ItemType]:FindFirstChild(ItemName) then
	return false, "You don't own this item"
end

You can find this statement under ServerMain. Feel free to remove it if you want to allow multiple copies of tools to be sold, but they may not save or work consistently with the inventory.

(RPG games often don’t allow multiple copies to avoid spams of boss weapons and such, which can make it tedious to keep your inventory clean)

1 Like

You are indeed correct! The mobile support for the initial release isn’t too good, and I do plan to improve it over time. The two main concerns here (aside from possible scaling improvements) is the positioning of the left stats/character info frame, and inventory dragging.

The reason this doesn’t work is since the hotbar dragging only detects Mouse input. To make this work with Touch input, try replacing the dragging logic in your “Inventory” module around line 516 with the snippet here:

Slot Dragging Code
---- Slot dragging (to & from hotbar)
local IsInputDown = false
local CursorStick

UserInputService.InputBegan:Connect(function(InputObject, GameEvent)
	if not InventoryOpen then
		return
	end
	
	if table.find({Enum.UserInputType.MouseButton1, Enum.UserInputType.Touch}, InputObject.UserInputType) then
		IsInputDown = true
		local Type, Slot = GetSlotOverCursor()
		
		if Type == "Inventory" then
			-- Yield until the user moves their cursor a few pixels, and make sure they're still dragging.
			local Origin = UserInputService:GetMouseLocation()
			while (Origin - UserInputService:GetMouseLocation()).Magnitude < 3 do
				if not IsInputDown then
					break
				end
				task.wait()
			end
			
			if IsInputDown then
				StartSlot = Slot
				StartParent = Slot.Frame.Parent
				Dragging = true
				
				Slot.Active = false
				CursorStick = RunService.PreRender:Connect(function()
					local MouseLocation = UserInputService:GetMouseLocation()
					Slot.Frame.Position = UDim2.fromOffset(MouseLocation.X - 32, MouseLocation.Y - 32)
				end)
				
				-- Temporarily show hotbar slot
				if Slot.HotbarNumber then
					HotbarSlots[Slot.HotbarNumber].Frame.Visible = InventoryOpen
				end
				
				Slot.Frame.Parent = Gui
			end
		end
	end
end)

UserInputService.InputEnded:Connect(function(InputObject, GameEvent)
	if table.find({Enum.UserInputType.MouseButton1, Enum.UserInputType.Touch}, InputObject.UserInputType) then
		IsInputDown = false
		if not Dragging then
			return
		end
		task.delay(nil, function() -- Delay a Heartbeat frame due to race conditions with Slot.Frame.Activated for equipping
			Dragging = false
		end)
		
		if CursorStick then
			CursorStick:Disconnect()
		end
		
		local Type, Slot = GetSlotOverCursor()
		
		if StartSlot then
			StartSlot.Active = false
			StartSlot.Frame.Parent = StartParent
			if StartSlot.HotbarNumber then
				HotbarSlots[StartSlot.HotbarNumber].Frame.Visible = false
			end
			
			if isCursorOverInventory() and isSlotInHotbar(StartSlot) then
				StartSlot:PushToInventory()
			else
				if Type == "Hotbar" then
					StartSlot:PushToHotbar(Slot)
				elseif Type == "Inventory" then
					StartSlot:ExchangeWith(Slot)
				end
			end
		end
		
		StartSlot = nil
		StartParent = nil
	end
end)

Let me know if that helps!

Update: Pushed mobile improvements in the latest version

7 Likes

It did trash the first copy of the tool along with the second copy, when the second copy tool is in my inventory before the first copy tool bought from the shop thanks! But what I mean is the second copy did not show up from the pawn to become sellable? How can the second copy be sellable?

2 Likes

In the changelog you said:

Added Crossbow & Ranged weapon logic which can be used for bows, guns, magic weapons, sentries, enemies, and practically anything you want to. Decent scripting knowledge is recommended before diving into trying to make this logic work outside of the provided weapon template.

So does this mean we can’t easly give the mob a crossbow etc. to use it, and use it against us ?

1 Like

Unfortunately you can’t unless if you have some scripting knowledge (as I don’t want to cram this kit with every feature which may steer new devs from learning from it), but there are many community-made add-ons for this kit already which you can check out. I’m sure someone will make one for mobs too at some point.

2 Likes

I just wanted to share a game I made using this kit. I remade an old RPG that I made in 2017 called Immortal RPG. I made all of the models for the game and barely had to script anything thanks to this kit. This just shows how much you can do using this kit.

5 Likes

In the modules where can I add a different style of attacking for the enemies. I wanted to make a ranged enemy but idk which module to put it in

2 Likes

nvm i made a new script with the logic

3 Likes

Hi,

Do you have an open source editable game with some examples or a .rbxl file you can share?

Thanks

2 Likes

The script has a find nearest player in a sphere of however many studs you set the variable to. I have it rotate the enemy to face the player using cframes and then i have it fire a projectile towards the player and inside the projectile that is fired there is a script that has custom code but a simple damage script can work too

2 Likes

Ok, thanks

Do you know how to make range weapon not have an arc? meaning it goes straight?

Also to be able to set a max distance it can travel?

Thanks

2 Likes

Why does the hotbar only save when leaving and rejoining and not when dying?

3 Likes